Create PDB from PDB$SEED

The creation of a new PDB from the seed is nearly instantaneous. The operation copies the
data files from the READ ONLY seed PDB to the target directory defined in the CREATE
PLUGGABLE DATABASE statement.

It creates tablespaces such as SYSTEM to store a full catalog including metadata pointing to
Oracle-supplied objects, SYSAUX for local auxiliary data.

It creates default schemas and common users that exist in seed PDB, SYS who continues to
have all superuser privileges and SYSTEM who can administer the PDB.
It creates a local user (the PDBA) granted a local PDB_DBA role. Until the PDB SYS user grants
privileges to the local PDB_DBA role, the new PDBA cannot perform any other operation than
connecting to the PDB.

A new default service is also created for the PDB.

1. Create the folder to place the pdb datafiles, in this example I am using ASM, the procedure is the same if you are using non RAC (ordinary file system)

[oracle@ora12cn1 ~]$ su - grid
Password:
[grid@ora12cn1 ~]$ asmcmd
ASMCMD> cd +DATA
ASMCMD> mkdir pdb2
ASMCMD> cd pdb2
ASMCMD> pwd
+DATA/pdb2
ASMCMD> 


2. Connect to root, with sys as sysdba

[oracle@ora12cn1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 25 15:55:04 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> 

3. Identify the location of PDB$SEED datafiles.

SQL> alter session set container=PDB$SEED;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB$SEED

SQL> select file_name from dba_data_files;

FILE_NAME
-------------------------------------------
+DATA/pdb$seed_system01.dbf
+DATA/pdb$seed_sysaux01.dbf


4.  Connect to root and issue the CREATE PLUGGABLE DATABASE command

SQL> conn / as sysdba            
Connected.
SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> CREATE PLUGGABLE DATABASE pdb2
  2  ADMIN USER pdb2_admin IDENTIFIED BY oracle ROLES=(CONNECT)
  3  FILE_NAME_CONVERT=('+DATA', '+DATA/pdb2');

Pluggable database created.

SQL> alter session set container = PDB2;

Session altered.
SQL> show con_name

CON_NAME
------------------------------
PDB2
5. The services is automatically created

[oracle@ora12cn1 oracle]$ lsnrctl services
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 25-NOV-2013 17:50:25
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12c" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12cXDB" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ora12cn1, pid: 4003>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ora12cn1.localdomain)(PORT=52784))
Service "pdb1" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "pdb2" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
The command completed successfully

6. Now test open the database

SQL> alter pluggable database pdb2 open; 

Pluggable database altered.

SQL> select name, con_id, open_mode from v$pdbs; 

NAME            CON_ID OPEN_MODE
---------- ---------- ----------
PDB$SEED            2 READ ONLY
PDB1               3 MOUNTED
PDB2               4 READ WRITE


7. Check the data and temp files

SQL> alter session set container=pdb2;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB2

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb2/pdb$seed_system01.dbf
+DATA/pdb2/pdb$seed_sysaux01.dbf

SQL> select file_name from dba_temp_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb2/pdbseed_temp01.dbf


You may want to refer to modified Create PDB from PDB$SEED (appropriate PDB directory) post that explain appropriate PDB directory.

About