SIMPLE DATABASE CREATION
CREATION OF DATABASE IN COMMAND LINE:
1) Set Environment file:
#su – oracle
$pwd
export ORACLE_SID=PROD
export ORACLE_HOME=/u01/app/oracle/PRODuct/11.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
2) Create Parameter file:
$cd $ORACLE_HOME/dbs
$cpinit.ora initPROD.ora
vi $ORACLE_HOME/dbs/initPROD.ora
db_name = PROD
control_files=/u01/PROD/control1.ctl,/u01/PROD/control2.ctl
undo_management = AUTO
undo_tablespace = UNDOTBS1
diagnostic_dest=/u01/PROD/
:wq!
3) Start the instance:
Edit the file $ORACLE_HOME/sqlplus/admin/glogin.sql and add in line as below.
setsqlprompt “_USER’@’_CONNECT_IDENTIFIER> ”
sqlplus / as sysdba
startup nomount
Note : In the nomount state oracle reads all initialization parameter values from the pfile(initPROD.ora)
4) Create the database:
vi create.sql
create database test
logfile group 1 (‘/u01/PROD/redo1.log’) size 100M,
group 2 (‘/u01/PROD/redo2.log’) size 100M,
group 3 (‘/u01/PROD/redo3.log’) size 100M
datafile ‘/u01/PROD/system.dbf’ size 500M autoextend on next 10M maxsize unlimited extent management local
sysauxdatafile ‘/u01/PROD/sysaux.dbf’ size 100M autoextend on next 10M maxsize unlimited
undotablespace undotbs1 datafile ‘/u01/PROD/undotbs1.dbf’ size 100M
default temporary tablespace temp tempfile ‘/u01/PROD/temp01.dbf’ size 100M;
sqlplus / as sysdba
@create.sql
5) Run catalog and catproc:
After Successful creation of the database we need to execute catalog.sql and catproc.sql.These two scripts updates the data dictionary tables and views. And pupbld.sql must be executed from Systemuser.This script updates users product information.
sqlplus / as sysdba
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
connect system/manager
@?/sqlplus/admin/pupbld.sql
####### Use Below dictionary view to see database information #####
sys@PROD>select * from v$version;
sys@PROD>select * from v$tablespace;
sys@PROD>select name from v$datafile;
sys@PROD>select name from v$tempfile;
sys@PROD>select name from v$controlfile;
sys@PROD>set wrap off
sys@PROD>select * from v$logfile;