Creating a new database in oracle using cmd
To create a new database in Oracle using the Command Prompt (Cmd), you'll need to follow these steps:
Prerequisites:
- Oracle Database software installed on your machine.
- Oracle Database Configuration Assistant (DBCA) installed and configured.
- You have the necessary permissions to create a new database.
Step 1: Open the Command Prompt
- Press the Windows key + R to open the Run dialog box.
- Type
cmd
and press Enter to open the Command Prompt.
Step 2: Navigate to the Oracle Home Directory
-
In the Command Prompt, navigate to the Oracle Home directory by typing the following command and pressing Enter:
cd %ORACLE_HOME%
Replace
%ORACLE_HOME%
with the actual path to your Oracle Home directory. For example:cd C:\oracle\product\12.2.0\dbhome_1
Step 3: Run the Database Creation Script
-
Run the following command to create a new database:
dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname ORCL -sid ORCL -password <password>
Replace
<password>
with the password you want to use for the database.
Here's a breakdown of the options used:
-silent
: Runs the DBCA in silent mode, without prompting for user input.-createDatabase
: Creates a new database.-templateName General_Purpose.dbc
: Specifies the template to use for the database creation. You can choose from various templates, such as General_Purpose, Enterprise, or Standard.-gdbname ORCL
: Specifies the global database name.-sid ORCL
: Specifies the system identifier (SID) for the database.-password <password>
: Specifies the password for the database.
Step 4: Wait for the Database Creation to Complete
- The DBCA will create the new database and configure it according to the specified template. This process may take several minutes to complete.
Step 5: Verify the Database Creation
- Once the database creation is complete, you can verify that the database has been created by running the following command:
sqlplus / as sysdba
This will connect you to the database as the SYS user. You can then run queries to verify that the database has been created successfully.
That's it! You have now created a new database in Oracle using the Command Prompt.