Home » Oracle » Oracle Database » Oracle database 12c:How to create Pluggable database in 12c database

Oracle database 12c:How to create Pluggable database in 12c database

Today we are going to talked about How to create Pluggable database in Oracle 12c database

We have already learned to create the container database which has one seed PDB

 

How to create Pluggable database in 12c database

Pluggable database in 12 database  can be created in following ways

1) Create a pluggable database using the seed container.
The seed data files are copied to the new location and used by the new database. The catalog scripts, etc do not need to be executed afresh.

a) Login to root container with user  have create pluggable database privilege

If OMF is set using DB_CREATE_FILE_DEST then

CREATE PLUGGABLE DATABASE test1_tech
ADMIN USER tech_admin IDENTIFIED BY oracle
;

It does following things
1) Copied the seed datafiles to new database
2) Create system,sysaux tablespace
3) Create the temp tablespace
4) Creates a full catalog including metadata pointing to Oracle-supplied objects
5) Create common user SYS and SYSTEM
6) Create the local user tech_admin

If OMF is not set then

CREATE PLUGGABLE DATABASE test1_tech
ADMIN USER tech_admin IDENTIFIED BY oracle
FILE_NAME_CONVERT= (‘/u01/oracle/CDB1/datafile/seed’,
‘/u01/oracle/CDB1/datafile/techdata’);
;

There is one more parameter which can be set in init.ora avoid the location clause given above
PDB_FILE_NAME_CONVERT

b) The new PDB created is in mounted state only, we need to make it read write before using it

SQL> alter pluggable database test1_tech open read write;

Pluggable database altered.
SQL> select pdb_name,status from cdb_pdbs;

PDB_NAME STATUS
——————– ——————–
PDB$SEED NORMAL
test1_tech NORMAL

2) Create a pluggable database by duplicating an existing one.
The files from the existing database are copied to the location of the new database. The new database automatically gets assigned new pdb id to distinguish it from its parent.
Suppose we want to create PDB(test2_tech) from existing db test1_tech,

See also  How to check PSU patch version in oracle

a) Close the test1_tech database and open read only

alter pluggable database test1_tech close;

Pluggable database altered.

SQL> alter pluggable database test1_tech open read only;

Pluggable database altered.

b) If OMF is set i.e DB_CREATE_FILE_DEST or CREATE_FILE_DEST,

CREATE PLUGGABLE DATABASE
test2_tech FROM test1_tech;

if OMF not set

CREATE PLUGGABLE DATABASE
test2_tech FROM test1_tech
FILE_NAME_CONVERT= (‘/u01/oracle/CDB1/datafile/techdata’,
‘/u01/oracle/CDB1/datafile/tech2data’);
;

c) ReOpen the source PDB

alter pluggable database test1_tech open;

d) Open the clone db in read write mode

SQL> alter pluggable database test2_tech open read write;

Pluggable database altered.
SQL> select pdb_name,status from cdb_pdbs;

PDB_NAME STATUS
——————– ——————–
PDB$SEED NORMAL
test1_tech NORMAL
test2_tech NORMAL

 Related Articles

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top