CREATE PDB USING SEED

CREATE PLUGGABLE DATABASE MANUALLY USING SEED(PDB$SEED)

Contents
___________________________________________________________________________________________________

1. Pre-requisites
2. Create PDB using seed (PDB$SEED)
3. Verify
___________________________________________________________________________________________________


1. Pre-requisites

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT
SQL> 

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

NAME      OPEN_MODE                CON_ID
--------- -------------------- ----------
CDB2      READ WRITE                    0

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
SQL> 

Note: we don't see any pdb database here. 
SQL> select name,con_id,dbid from v$containers;

NAME                               CON_ID       DBID
------------------------------ ---------- ----------
CDB$ROOT                                1  680230459
PDB$SEED                                2 2993936271  <--- CON_ID 2 for PDB$SEED

SQL> select name from v$datafile where con_id=0;

no rows selected

SQL> 

SQL> select name from v$datafile where con_id=2;

NAME
--------------------------------------------------------------------------------
/u02/oradata/CDB2/pdbseed/system01.dbf
/u02/oradata/CDB2/pdbseed/sysaux01.dbf
/u02/oradata/CDB2/pdbseed/undotbs01.dbf

SQL> select name from v$tempfile where con_id=2;

NAME
--------------------------------------------------------------------------------
/u02/oradata/CDB2/pdbseed/temp01.dbf

SQL> 


2. Create PDB using seed (PDB$SEED)

[oracle@localhost ~]$ mkdir -p /home/oracle/oradata/PDB1

SQL> create pluggable database PDB1 admin user pdb1dba identified by "oracle"
  2  default tablespace PDB1_USERS
  3  datafile '/home/oracle/oradata/PDB1/pdb1_users01.dbf' size 250m autoextend on
  4  storage (maxsize 1g max_shared_temp_size 1g)
  5  file_name_convert=('/u02/oradata/CDB2/pdbseed/','/home/oracle/oradata/PDB1/');

Pluggable database created.

SQL>

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           MOUNTED   <-------
SQL> alter pluggable database PDB1 open;

Pluggable database altered.

SQL> 


3. Verification

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO  <------
SQL> 

SQL> select name from v$datafile where con_id=3;

NAME
--------------------------------------------------------------------------------
/home/oracle/oradata/PDB1/system01.dbf
/home/oracle/oradata/PDB1/sysaux01.dbf
/home/oracle/oradata/PDB1/undotbs01.dbf
/home/oracle/oradata/PDB1/pdb1_users01.dbf

SQL> select name from v$tempfile where con_id=3;

NAME
--------------------------------------------------------------------------------
/home/oracle/oradata/PDB1/temp01.dbf

SQL>


SQL> select name,con_id,dbid from v$containers;

NAME                     CON_ID       DBID
-------------------- ---------- ----------
CDB$ROOT                      1  680230459
PDB$SEED                      2 2993936271
PDB1                          3  627484885

SQL>

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.