Create 12c Container Database Using OMF
Overview
Create a container database manually with using OMF.
References
- Database Administrator's Guide 12.1
- "ORA-01917: User Or Role 'PDB_DBA' Does Not Exist" while creating container enabled (cdb) database manually (Doc ID 1967358.1)
Procedure
Preliminaries
The procedure to follow can be found in Creating a CDB with the CREATE DATABASE Statement, and Create 12C Non-CDB Database Using OMF.
Step 1: Specify an Instance Identifier (SID)
The database and instance name is JAR.
Step 2: Ensure That the Required Environment Variables Are Set
The following update is made to /etc/oratab:
jar:/opt/app/oracle/product/12.1.0/dbhome_1:N
The appropriate environment variables are set as follows:
. oraenv
Step 3: Choose a Database Administrator Authentication Method
The password file is created as follows:
cd ${ORACLE_HOME}/dbs
orapwd file=orapwd${ORACLE_SID}
Step 4: Create the Initialization Parameter File
The following data is entered into /home/oracle/initjar.ora:
cat >initjar.ora <<DONE
*.audit_file_dest='/opt/app/oracle/admin/jar/adump'
*.audit_trail='db'
*.compatible='12.1.0.2.0'
*.db_block_size=8192
*.db_create_file_dest='/opt/app/oracle/oradata'
*.db_create_online_log_dest_1='/opt/app/oracle/oradata'
*.db_create_online_log_dest_2='/opt/app/oracle/fast_recovery_area'
*.db_domain='yaocm.id.au'
*.db_name='jar'
*.db_recovery_file_dest='/opt/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=9G
*.diagnostic_dest='/opt/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=jarXDB)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
*.memory_target=1470m
*.open_cursors=300
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
*.enable_pluggable_database=TRUE
DONE
The key difference with the non-CDB case is the inclusion of the last parameter.
The following directories are created:
mkdir -p /opt/app/oracle/admin/jar/adump
mkdir -p /opt/app/oracle/oradata
mkdir -p /opt/app/oracle/fast_recovery_area
Set Up PERL Environment
According to "ORA-01917: User Or Role 'PDB_DBA' Does Not Exist" while creating container enabled (cdb) database manually (Doc ID 1967358.1), the PERL environment should reference the one supplied by the Oracle RDBMS installation. The PATH variable to reflect this:
export PATH=${ORACLE_HOME}/perl/bin:${PATH}
Step 6: Connect to the Instance
Instead of following the procedure, I used the following commands instead:
sqlplus / as sysdba
startup nomount pfile='/home/oracle/initjar.ora'
The reason is to check the syntax and validity of the initialization parameters before creating the spfile.
Step 7: Create a Server Parameter File
The spfile is created in the default location (${ORACLE_HOME}/dbs) as follows:
CREATE SPFILE FROM PFILE='/home/oracle/initjar.ora';
Step 8: Start the Instance
The instance is started using the spfile:
startup nomount force
Step 9: Issue the CREATE DATABASE Statement
The database is created using the following command:
create database jar
user sys identified by "&pw_sys"
user system identified by "&pw_system"
logfile group 1 size 50m,
group 2 size 50m,
group 3 size 50m
character set al32utf8 national character set al16utf16
set default bigfile tablespace
archivelog
set time_zone='+10:00'
extent management local
default temporary tablespace temp
default tablespace users
undo tablespace undotbs1
enable pluggable database
/
The key difference with the non-CDB case is the inclusion of the following:
enable pluggable database
Install CDB Components
The key difference with the non-CDB case is the replacement of the catalog.sql
and catproc.sql
with catcdb.sql
.
According to "ORA-01917: User Or Role 'PDB_DBA' Does Not Exist" while creating container enabled (cdb) database manually (Doc ID 1967358.1), the following commands are run to install the CDB components:
connect / as sysdba
@?/rdbms/admin/catcdb.sql
connect system
@?/sqlplus/admin/pupbld.sql
Gotchas
Using SQL*Plus Error Handling
The use of WHENEVER OSERROR EXIT FAILURE ROLLBACK
gives the following messages:
catcon.pl: completed successfully O/S Message: No child processes
And the catcdb.sql
script finishes prematurely.
PRODUCT_USER_PROFILE Missing From SEED Database
Using this method means that the PRODUCT_USER_PROFILE
table is missing from the SEED database. After a pluggable database is created from the SEED, you will have to run the following commands:
CONNECT SYSTEM
ALTER SESSION SET container=&pdb.;
@?/sqlplus/admin/pupbld.sql