In this article we will clone a pluggable database from existing PDB ( PROD), residing on the same container.

First start the PDB in read only , which need to be cloned.

SQL> select name,open_mode from v$pdbs;

NAME			       OPEN_MODE
------------------------------ ----------
PDB$SEED		       READ ONLY
ORCL			       READ WRITE
PROD			       READ WRITE


SQL> alter session set container=PROD;

Session altered.

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/home/oracle/app/oracle/oradata/cdb1/prod/system01.dbf
/home/oracle/app/oracle/oradata/cdb1/prod/sysaux01.dbf

SQL> show con_name

CON_NAME
------------------------------
PROD


SQL> shutdown immediate;
Pluggable Database closed.

SQL> startup open read only
Pluggable Database opened.

Connect to the container and clone the pluggable:

----If you don't connect to container , then below error will come

SQL>  create pluggable database PROD_CL from PROD FILE_NAME_CONVERT=('/home/oracle/app/oracle/oradata/cdb1/PROD','/home/oracle/app/oracle/oradata/cdb1/PROD_CL');
 create pluggable database PROD_CL from PROD FILE_NAME_CONVERT=('/home/oracle/app/oracle/oradata/cdb1/PROD','/home/oracle/app/oracle/oradata/cdb1/PROD_CL')
*
ERROR at line 1:
ORA-65040: operation not allowed from within a pluggable database


-- connect to container CDB1

SQL> conn sys/oracle@cdb1 as sysdba
Connected.
SQL> show con_name

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



-- Clone pluggable 


SQL> create pluggable database PROD_CL from PROD FILE_NAME_CONVERT=('/home/oracle/app/oracle/oradata/cdb1/prod','/home/oracle/app/oracle/oradata/cdb1/PROD_CL');

Pluggable database created.

Now make the existing PDB ( PROD) from read only to read write:


SQL> select name,open_mode from v$pdbs;

NAME			       OPEN_MODE
------------------------------ ----------
PDB$SEED		       READ ONLY
ORCL			       READ WRITE
PROD			       READ ONLY
PROD_CL 		       MOUNTED

SQL> alter session set CONTAINER=PROD;

Session altered.

SQL> shutdown immediate;
Pluggable Database closed.
SQL> startup
Pluggable Database opened.
SQL> show con_name

start the new cloned PDB( PROD_CL)


SQL> alter session set container=PROD_CL;

Session altered.

SQL> startup
Pluggable Database opened.


SQL> conn sys/oracle@cdb1 as sysdba
Connected.
SQL> select name,open_mode from v$pdbs;

NAME			       OPEN_MODE
------------------------------ ----------
PDB$SEED		       READ ONLY
ORCL			       READ WRITE
PROD			       READ WRITE
PROD_CL 		       READ WRITE