Oracle DBA Tips and Techniques

By Arjun Raja

CREATE PLUGGABLE DATABASE

Posted by Arjun Raja on June 11, 2014

CREATE PLUGGABLE DATABASE

Currently we have a CDB_ROOT and PDB_SEED.

CDB_ROOT is the container database.

PDB_SEED is the template to be used to create new pluggable databases.

Current PDB

— ******************************************
REM Check how many PDBs are in the current container

select
v.name,
v.open_mode,
nvl(v.restricted, ‘n/a’) “RESTRICTED”,
d.status
from
v$pdbs v
inner join
dba_pdbs d
using (GUID)
order by v.create_scn;

NAME OPEN_MODE RESTRICTED STATUS
—————————— ———- ———- ————-
PDB$SEED READ ONLY NO NORMAL

Now create a new Pluggable database using the copy method – copying the pdb_seed.

CREATE PLUGGABLE DATABASE pdb1d1 ADMIN USER pdb1d1admin IDENTIFIED BY oracle12c
FILE_NAME_CONVERT=(‘/u02/oradata/cdbd1/pdbseed/’,’/u02/oradata/cdbd1/pdb1d1′);

Pluggable database created.

select
v.name,
v.open_mode,
nvl(v.restricted, ‘n/a’) “RESTRICTED”,
d.status
from
v$pdbs v
inner join
dba_pdbs d
using (GUID)
order by v.create_scn;

NAME OPEN_MODE RESTRICTED STATUS
—————————— ———- ———- ———————————————-
PDB$SEED READ ONLY NO NORMAL
PDB1D1 MOUNTED n/a NEW

The new pluggable database is still in NEW state.

They must be opened in READ WRITE mode atleast once for the integration of the PDB into CDB to be complete.

ALTER PLUGGABLE DATABASE PDB1D1 OPEN READ WRITE;

Pluggable database altered.

SQL> select
v.name,
v.open_mode,
nvl(v.restricted, ‘n/a’) “RESTRICTED”,
d.status
from
v$pdbs v
inner join
dba_pdbs d
using (GUID)
order by v.create_scn; 2 3 4 5 6 7 8 9 10 11

NAME OPEN_MODE RES STATUS
—————————— ———- — ————-
PDB$SEED READ ONLY NO NORMAL
PDB1D1 READ WRITE NO NORMAL

Advertisements

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: