Set Environment for NEW Database:
export ORACLE_SID=NEWDB
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
cd $ORACLE_HOME/dbs
vi initnewcdb.ora
sga_target=500M
pga_aggregate_target=260M
audit_file_dest="/u01/app/oracle/admin/newcdb/adump"
audit_trail=db
compatible=12.1.0.2.0
control_files=/u01/oradata/NEWDB/control01.ctl
db_block_size=8192
db_domain=localdomain
db_name="newcdb"
db_recovery_file_dest_size=4560m
diagnostic_dest=/u01/app/oracle
dispatchers="(PROTOCOL=TCP) (SERVICE=NEWDBXDB)"
enable_pluggable_database=true
open_cursors=300
processes=300
remote_login_passwordfile=EXCLUSIVE
undo_tablespace=UNDOTBS1
Create Needed Directories for Control file, Datafile, Redo Log File & ADUMP
Create DB Script:
vi create_db_newcdb.sql
CREATE DATABASE "NEWDB"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE '/u01/oradata/NEWDB/system01.dbf' SIZE 700M REUSE
AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/oradata/NEWDB/sysaux01.dbf' SIZE 550M REUSE
AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/oradata/NEWDB/temp01.dbf'
SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/u01/oradata/NEWDB/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
LOGFILE
GROUP 1 ('u01/oradata/NEWDB/redo01.log') SIZE 50M,
GROUP 2 ('u01/oradata/NEWDB/redo02.log') SIZE 50M,
GROUP 3 ('u01/oradata/NEWDB/redo03.log') SIZE 50M
USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword"
enable pluggable database
seed file_name_convert=(
'/u01/oradata/NEWDB/system01.dbf','/u01/oradata/NEWDB/pdbseed/system01.dbf',
'/u01/oradata/NEWDB/sysaux01.dbf','/u01/oradata/NEWDB/pdbseed/sysaux01.dbf',
'/u01/oradata/NEWDB/temp01.dbf','/u01/oradata/NEWDB/pdbseed/temp01.dbf',
'/u01/oradata/NEWDB/undotbs01.dbf','/u01/oradata/NEWDB/pdbseed/undotbs01.dbf'
);
Execute Create Database script:
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 524288000 bytes
Fixed Size 2926320 bytes
Variable Size 268437776 bytes
Database Buffers 247463936 bytes
Redo Buffers 5459968 bytes
SQL> @/home/oracle/bin/create_db_newcdb.sql
We need to run the Oracle supplied dictionary scripts like catalog.sql, catproc.sql, pupbld.sql to populate the necessary dictionary views when we create a Oracle database manually using CREATE DATABASE statement.
# running catalog.sql script against CDB containers
$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -u sys -d $ORACLE_HOME/rdbms/admin -b catalog_output -e -l /home/oracle catalog.sql
# running catproc.sql script against CDB containers
$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -u sys -d $ORACLE_HOME/rdbms/admin -b catproc_output -e -l /home/oracle catproc.sql
# running pupbld.sql script against CDB containers
$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -u system -d $ORACLE_HOME/sqlplus/admin -b pupbld_output -e -l /home/oracle pupbld.sql
For Container Database run the Oracle supplied dictionary scripts
SQL> @?/rdbms/admin/catcdb.sql
Compile the Invalid objects:
SQL>@?/rdbms/admin/utlrp.sql
Creating PDB mypdb_01 using seed database (PDB$SEED)
SQL>CREATE PLUGGABLE DATABASE newpdb1 ADMIN USER pdbadmin IDENTIFIED BY oracle
FILE_NAME_CONVERT=('/u01/oradata/NEWDB/pdbseed/','/u01/oradata/NEWDB/newpdb1/');
Pluggable database created.
Open the PDB for READ-WRITE
ALTER PLUGGABLE DATABASE newpdb1 OPEN;
Pluggable database altered.