Cloning a Local Pluggable Database (PDB) in Oracle Database 12c Release 2

Clone a Local PDB:

step 1  : Connect to the Container Database

step 2 : Check the Local pluggable Database in that Container Database

[oracle@ram ~]$ export ORACLE_SID=orcl
[oracle@ram ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Oct 10 22:12:56 2018

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1660944384 bytes
Fixed Size 8793448 bytes
Variable Size 1056965272 bytes
Database Buffers 587202560 bytes
Redo Buffers 7983104 bytes
Database mounted.
Database opened.

SQL> sho con_name

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

Step 3 : If that particular Local Pluggable Database not in READ ONLY mode alter that PDB into READ ONLY mode.

Step 4 : With the file_name_convert parameter create cloning pluggable database

Step 5 : Now we can check the Local Pluggable Database through V$PDBS view.We can alter like normal pluggable Database as read only,close,read write modes.

SQL> col name for a15
SQL> /

NAME             OPEN_MODE
------------    ----------
ORCLPDB          MOUNTED
PDB$SEED         READ ONLY

SQL> alter pluggable database all open;

Pluggable database altered.

SQL> col name for a15
SQL> select name,open_mode from v$pdbs;

NAME            OPEN_MODE
-------------  ----------
PDB$SEED        READ ONLY
ORCLPDB         READ WRITE

SQL> alter pluggable database orclpdb close;

Pluggable database altered.

SQL> alter pluggable database orclpdb open read only;

Pluggable database altered.


SQL> select name,open_mode from v$pdbs;

NAME             OPEN_MODE
-----------      ----------
PDB$SEED         READ ONLY
ORCLPDB          READ ONLY

SQL> create pluggable database orclpdb1 from orclpdb file_name_convert=('/u01/app/oracle/oradata/orcl/orclpdb/','/u01/app/oracle/oradata/orcl/orclpdb1/');

Pluggable database created.

SQL> alter pluggable database orclpdb1 open;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME            OPEN_MODE
------------    ----------
PDB$SEED        READ ONLY
ORCLPDB         READ ONLY
ORCLPDB1        READ WRITE

SQL> alter pluggable database orclpdb close;

Pluggable database altered.

SQL> alter pluggable database orclpdb open;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME            OPEN_MODE
------------   ----------
PDB$SEED        READ ONLY
ORCLPDB         READ WRITE
ORCLPDB1        READ WRITE

 

If we need to Delete Local Pluggable Database

  1. Switch to that Pluggable Database to close mode.
  2. Drop the Pluggable Database with Datafiles.

 

SQL> select name,open_mode from v$pdbs;

NAME             OPEN_MODE
-------------    ----------
PDB$SEED         READ ONLY
ORCLPDB          READ WRITE
ORCLPDB1         READ WRITE

SQL> alter pluggable database orclpdb1 close;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME           OPEN_MODE
------------- ----------
PDB$SEED       READ ONLY
ORCLPDB        READ WRITE
ORCLPDB1       MOUNTED

SQL> drop pluggable database orclpdb1 including datafiles;

Pluggable database dropped.

Thus the Pluggable Database dropped successfully.

Catch Me On:- Hariprasath Rajaram

Telegram:https://t.me/joinchat/I_f4DhGF_Zifr9YZvvMkRg
LinkedIn:https://www.linkedin.com/in/hari-prasath-aa65bb19/
Facebook:https://www.facebook.com/HariPrasathdba
FB Group:https://www.facebook.com/groups/894402327369506/
FB Page: https://www.facebook.com/dbahariprasath/?
Twitter: https://twitter.com/hariprasathdba

Leave a Reply

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