Oracle Database Creation
1. DBCA (Database Configuration Assistance)
2. Manual Database Creation
1. DBCA (Database Configuration Assistance)
#xhost + (from root user)
$su - oracle
$dbca
follow the instructions to create database using dbca
2. Manual Database Creation
$vi .bash_profile
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=mytestdb; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/
jlib; export CLASSPATH
execute the bash_profile
$. .bash_profile
$echo $ORACLE_SID
mytestdb
2. Manual Database Creation
create the parameter file from init.ora
$cd $ORACLE_HOME/dbs
$cp init.ora initmytestdb.ora
make changes as per mytestdb database
$vi mytestdb.ora
mytestdb.__db_cache_size=167772160
mytestdb.__java_pool_size=4194304
mytestdb.__large_pool_size=4194304
mytestdb.__oracle_base='/u01/app/oracle' #ORACLE_BASE set from environment
mytestdb.__pga_aggregate_target=205520896
mytestdb.__sga_target=301989888
mytestdb.__shared_io_pool_size=0
mytestdb.__shared_pool_size=117440512
mytestdb.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/mytestdb/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/mytestdb/control01.ctl','/u01/app/oracle/flash_recovery_
area/mytestdb/control02.ctl’
2. Manual Database Creation
.db_block_size=8192
*.db_domain=''
*.db_name='mytestdb'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=mytestdbXDB)'
*.memory_target=506462208
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
2. Manual Database Creation
.db_block_size=8192
*.db_domain=''
*.db_name='mytestdb'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=mytestdbXDB)'
*.memory_target=506462208
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
2. Manual Database Creation
As per mytestdb database make following changes to the parameters
mytestdb.__oracle_base='/u01/app/oracle'
audit_file_dest='/u01/app/oracle/admin/mytestdb/adump'
control_files='/u01/app/oracle/oradata/mytestdb/control01.ctl','/u01/ap
p/oracle/flash_recovery_area/mytestdb/control02.ctl'
db_name='mytestdb'
db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
db_recovery_file_dest_size=4039114752
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=mytestdbXDB)'
memory_target=506462208
undo_tablespace='UNDOTBS1'
2. Manual Database Creation
$mkdir -p /u01/app/oracle/admin/mytestdb/adump
$mkdir -p /u01/app/oracle/oradata/mytestdb
$mkdir -p /u01/app/oracle/flash_recovery_area/mytestdb
$sqlplus / as sysdba
SQL>startup nomount
2. Manual Database Creation
SQL> create database mytestdb
logfile group 1 ('/u01/app/oracle/oradata/mytestdb/redo01.log') size 50m,
group 2 ('/u01/app/oracle/oradata/mytestdb/redo02.log') size 50m,
group 3 ('/u01/app/oracle/oradata/mytestdb/redo03.log') size 50m
maxlogfiles 5
maxlogmembers 5
maxdatafiles 100
maxinstances 1
datafile '/u01/app/oracle/oradata/mytestdb/system01.dbf' size 500m reuse
extent management local
sysaux datafile '/u01/app/oracle/oradata/mytestdb/sysaux01.dbf' size 500m reuse
default tablespace users
datafile '/u01/app/oracle/oradata/mytestdb/users01.dbf' size 50m reuse
default temporary tablespace tempts1
tempfile '/u01/app/oracle/oradata/mytestdb/temp01.dbf' size 50m reuse
undo tablespace undotbs1
datafile '/u01/app/oracle/oradata/mytestdb/undo01.dbf' size 200m reuse
autoextend on maxsize unlimited;
Database created.
2. Manual Database Creation
Need to run following scripts
SQL>@$ORACLE_HOME/rdbms/admin/catalog.sql
SQL>@$ORACLE_HOME/rdbms/admin/catproc.sql
SQL>connect system/manager
SQL>@$ORACLE_HOME/sqlplus/admin/pupbld.sql
Query Controlfiles, Datafiles, Logfiles and Tempfiles
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/mytestdb/control01.ctl
/u01/app/oracle/flash_recovery_area/mytestdb/control02.ctl
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/mytestdb/system01.dbf
/u01/app/oracle/oradata/mytestdb/undo01.dbf
/u01/app/oracle/oradata/mytestdb/sysaux01.dbf
/u01/app/oracle/oradata/mytestdb/users01.dbf
Query Controlfiles, Datafiles, Logfiles and Tempfiles
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/mytestdb/redo01.log
/u01/app/oracle/oradata/mytestdb/redo02.log
/u01/app/oracle/oradata/mytestdb/redo03.log
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/mytestdb/temp01.dbf