DATABASE CREATION
Oracle Database can create by using the following 3 methods
- Manual database creation
- OMF method (Oracle Managed database Files)
- DBCA method (Database Configuration Assistance)
In this article we will discuss Manual database creation.
Steps to create database in manual method.
- Declare or specify variables or set up environmental variables:
First edit .bash_profile and then set up the following variables.
$ vi .bash_profile
1 2 3 4 |
export ORACLE_SID=nposqa1 export ORACLE_HOME=/u01/app/oracle/product/12.1.0 export ORACLE_BASE=/u01/app/oracle export PATH=$ORACLE_HOME/bin:$PATH:. |
Note: primary is oracle instance name
. .bash_profile to execute bash profile.
Check the declared variables by using following commands.
$ echo $ORACLE_HOME
Result: /u01/app/oracle/product/12.1.0
$ echo $ORACLE_SID
Result: primary
- Making directory:
Use the following command to create the directory for storing the CRD files.
1 2 3 |
mkdir –p /u01/oradata/nposqa1 cd /u01/oradata/nposqa1 |
- Create the initialization file.
use the following command using the following command.
1 2 3 4 |
cd $ORACLE_HOME/dbs ls –l init.ora cp init.ora init$ORACLE_SID.ora ls –l init$ORACLE_SID.ora (check the file information) |
Open the parameter file by using the following command.
1 |
vi init$ORACLE_SID.ora |
Now set the parameter files by using following commands.
1 2 3 |
db_name=nposqa1 control_files= /u01/oradata/primary/control.ctl diagnostic_dest= /u01/oradata/primary |
- Script for database creation:
Now write the script for database creation by using the following command.
Vi dbcreate.sql
Now create the database script.
1 2 3 4 5 6 7 8 9 |
create database nposqa1 datafile '/u01/oradata/nposqa1/system.dbf' size 300m autoextend on sysaux datafile '/u01/oradata/nposqa1/sysaux.dbf' size 250m autoextend on undo tablespace undotbs datafile '/u01/oradata/nposqa1/undotbs.dbf' size 100m default temporary tablespace temp tempfile '/u01/oradata/nposqa1/temp.dbf' size 50m default tablespace userdata datafile '/u01/oradata/nposqa1/userdata.dbf' size 150m logfile group 1('/u01/oradata/nposqa1/redo1a.log') size 4m, group 2('/u01/oradata/nposqa1/redo2a.log') size 4m; |
Save the Script.
The SYSTEM tablespace, consisting of the operating system file ‘/u02/demo/db/system.dbf’ is created as specified by the DATAFILE clause.
A SYSAUX tablespace is created, consisting of the operating system file ‘/u02/demo/db/sysaux.dbf ‘ as specified in the SYSAUX DATAFILE.
The UNDO TABLESPACE clause creates and names an undo tablespace that is used to store undo data for this database if you have specified UNDO_MANAGEMENT=AUTO in the initialization parameter file.
The DEFAULT TEMPORARY TABLESPACE clause creates a default temporary tablespace for this database.
The DEFAULT TABLESPACE clause creates the default permanent tablespace for this database.
Two redo log groups will create and each group will contains the single member.
- Script for data dictionary views:
Now write the script for data dictionary views by using the following command.
vi generateDDV.sql
Now create the script by using following commands:
1 2 3 4 5 |
@$ORACLE_HOME/rdbms/admin/catalog.sql @$ORACLE_HOME/rdbms/admin/catblock.sql @$ORACLE_HOME/rdbms/admin/catproc.sql connect system/manager @$ORACLE_HOME/sqlplus/admin/pupbld.sql |
- Connect and Start the database up to no mount state as a sysdba.
1 |
$ sqlplus / as sysdba |
1 |
SQL> startup nomount |
Note: Oracle database can be created in nomount state only.
- Run the Database creation script that is created.
1 |
SQL> @dbcreate.sql |
You can find the acknowledgement of database created successfully.
- Now we can check the database status using the below command.
1 2 3 4 |
SQL> Select status from v$instance; STATUS ----------- OPEN |
- Now we can check the database information using the below commands.
1 2 3 |
SQL> select name from v$database. SQL> select name from v$datafile. SQL> select name from v$controlfile. |
- Now run the script that Build Data Dictionary Views.
1 |
SQL> @generateDDV.sql |
The database will created and check the tables.
IN 12c , the count will be “6921”
Thank you …….
Ajay Kumar
Hello Everyone,
Please check below link for Manual database creation in Oracle.
https://vimeo.com/314250103
Thanks
ajay001
supper ajay its is relay help us