Dontcheff

How to create a CDB in Oracle 12.1.0

In Consolidation, DBA, Oracle database on June 30, 2013 at 12:27

The Database Configuration Assistant (DBCA) and the “CREATE DATABASE” statement are the 2 possible ways to create a container database in 12c.

In Oracle 12.1.0, ENABLE_PLUGGABLE_DATABASE is a bootstrap init.ora parameter used to create a CDB, and it enables a database in NOMOUNT startup mode to know that the database should be created as a CDB. One CDB, can have up to 252 pluggable databases. Enough for a start I would say.

The parameter ENABLE_PLUGGABLE_DATABASE must be set in init.ora before creating a CDB. The default is FALSE but in future Oracle releases all databases will probably be created as container databases.

DBCAPDB

In a CDB, the DB_NAME parameter specifies the name of the root. You may want to set the SID to the name of the root, although on the screenshot above you see that they are different. The maximum number of characters for this name is 30.

You can create the database manually using the create database command as follows:

CREATE DATABASE EXA8
  USER SYS IDENTIFIED BY sys_password
  USER SYSTEM IDENTIFIED BY system_password
  LOGFILE ...
  ENABLE PLUGGABLE DATABASE
    SEED
    FILE_NAME_CONVERT = ('/oradata/database/newcdb/', 
                         '/oradata/database/pdbseed/')
    SYSTEM DATAFILES SIZE 64M AUTOEXTEND ON NEXT 16M MAXSIZE UNLIMITED
    SYSAUX DATAFILES SIZE 64M AUTOEXTEND ON NEXT 16M MAXSIZE 1G
  USER_DATA TABLESPACE users
    DATAFILE '/oradata/database/pdbseed/users01.dbf'
    SIZE 32M REUSE AUTOEXTEND ON MAXSIZE 1G;

The USER_DATA tablespace created above is for storing user data and database options such as Oracle XML DB (a must install in 12c). PDBs created using the seed include this tablespace and its data file. The tablespace USER_DATA is not used by the root.

Afterwards, run the following script as sysdba:

@?/rdbms/admin/catcdb.sql

As several people have already noticed, the script is missing from the admin directory. There is an open bug about this: Bug 17033183 : MISSING FILE CATCDB.SQL IN $ORACLE_HOME/RDBMS/ADMIN.

It installs all of the components required by a CDB: PL/SQL packages in the root, etc.

Note that every PDB has its own SYSTEM and SYSAUX tablespace that differs from those of the root.

For a CDB, you can configure Oracle Enterprise Manager Database Express (EM Express) for the root and for each PDB by setting the HTTP or HTTPS port. You must use a different port for every container in a CDB.

EMDE12c

Here is what I ran in order to get to the image shown above:

exec DBMS_XDB_CONFIG.SETHTTPSPORT(5501);

I have been using EM DB Express for more than a year, starting with the first beta version of 12c. If you cannot get the GUI running, then just restart the database after executing the above command.

Database_Express 12c_9

After you create a CDB, it consists of really not much. Just the root and the seed! The root contains almost no user data. The user data resides in the PDBs.

Therefore, after creating a CDB, one of the first tasks is to add all the PDBs. Database consolidation and simplification. You name it!

There are 4 methods for adding PDBs to a CDB:

• Create new PDB from PDB$SEED pluggable database
• Plug in a non-CDB
• Clone a PDB from another PDB into the same or another CDB
• Plug an unplugged PDB into another CDB

CDB_PDBS

If you look on the left, under memory settings, you will see a new init.ora parameter: PGA_AGGREGATE_LIMIT. It is a real hard limit on PGA memory usage! If the value is reached, then Oracle aborts or terminates the sessions or processes that are consuming the most untunable PGA memory in the following order:

1. Calls for sessions that are consuming the most untunable PGA memory are aborted.

2. If PGA memory usage is still over the PGA_AGGREGATE_LIMIT, then the sessions and processes that are consuming the most untunable PGA memory are terminated.

P.S. One of my 4 sessions this September at Oracle OpenWorld will be “DBA Best Practices for Performance Tuning in a Pluggable World”.

Advertisements
  1. hi Julian,
    there is no catcdb.sql script in my installation of oracle 12c R1 I have checked ?/rdbms/admin/
    but could not find it , so I am unable to create a pdb manually, though I did create a cdb manually.

  2. @?/rdbms/admin/catcdb.sql
    this script is not der in my 12c home

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: