Create 12.1 Container Database No OMF

Overview

Create a container database manually without using OMF.

References

Procedure

Preliminaries

The procedure to follow can be found in Creating a CDB with the CREATE DATABASE Statement, and Create 12C Non-CDB Database Without 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'
*.control_files='/opt/app/oracle/jar/redo1/control.ctl','/opt/app/oracle/jar/redo2/control.ctl'
*.db_block_size=8192
*.db_domain='yaocm.id.au'
*.db_name='jar'
*.db_recovery_file_dest='/opt/app/oracle/jar/fast_recovery_area'
*.db_recovery_file_dest_size=4560m
*.diagnostic_dest='/opt/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=jarXDB)'
*.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/jar/oradata/root
mkdir -p /opt/app/oracle/jar/oradata/seed
mkdir -p /opt/app/oracle/jar/redo1
mkdir -p /opt/app/oracle/jar/redo2
mkdir -p /opt/app/oracle/jar/fast_recovery_area 

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 (
      '/opt/app/oracle/jar/redo1/redo01.log',
      '/opt/app/oracle/jar/redo2/redo01.log')
      size 50m,
    group 2 (
      '/opt/app/oracle/jar/redo1/redo02.log',
      '/opt/app/oracle/jar/redo2/redo02.log')
      size 50m,
    group 3 (
      '/opt/app/oracle/jar/redo1/redo03.log',
      '/opt/app/oracle/jar/redo2/redo03.log')
      size 50m
  character set al32utf8
  national character set al16utf16
  extent management local
    datafile '/opt/app/oracle/jar/oradata/root/system01.dbf'
      size 200m reuse autoextend on next 5m maxsize unlimited
  sysaux
    datafile '/opt/app/oracle/jar/oradata/root/sysaux01.dbf'
      size 200m reuse autoextend on next 5m maxsize unlimited
  default temporary tablespace temp
    tempfile '/opt/app/oracle/jar/oradata/root/temp01.dbf'
      size 200m reuse autoextend on next 5m maxsize unlimited
  undo tablespace undotbs1
    datafile '/opt/app/oracle/jar/oradata/root/undotbs101.dbf'
      size 200m reuse autoextend on next 5m maxsize unlimited
  enable pluggable database
  seed
    file_name_convert = (
      '/opt/app/oracle/jar/oradata/root',
      '/opt/app/oracle/jar/oradata/seed'
    )
  user_data tablespace users
    datafile '/opt/app/oracle/jar/oradata/seed/users01.dbf'
      size 200m reuse autoextend on next 5m maxsize unlimited
/

The key differences with the non-CDB case are the inclusion of the following:

  enable pluggable database
  seed
    file_name_convert = (
      '/opt/app/oracle/jar/oradata/root',
      '/opt/app/oracle/jar/oradata/seed'
    )
  user_data tablespace users
    datafile '/opt/app/oracle/jar/oradata/seed/users01.dbf'
      size 200m reuse autoextend on next 5m maxsize unlimited

And the removal of the DEFAULT TABLESPACE clause.

Step 11: Run Scripts to Build Data Dictionary Views

The following commands are run to build the data dictionary views and system packages:

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
connect system/&pw_system
@?/sqlplus/admin/pupbld.sql

Install CDB Components

The following commands are run to install the CDB components:

connect / as sysdba
@?/rdbms/admin/catcdb.sql