For this article I will use 2 Container Databases:
- orcl
- orcl2
[oracle@localhost ~]$ ps -ef |grep pmon
oracle 17189 1 0 Sep16 ? 00:00:00 ora_pmon_orcl2
oracle 22514 1 0 00:40 ? 00:00:00 ora_pmon_orcl
[oracle@localhost ~]$
The "orcl" container database has two Pluggable databases:
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB11 READ WRITE NO
4 PDB12 READ WRITE NO
The "orcl2" container database has 0 Pluggable databases.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
SQL>
The first step is to grant "create pluggable database" privilege to the user that we will use to clone the database, this privilege has to be granted inside the pdb that we want to clone, in this case is ORCL:PDB11.
In CDB "orcl":
SQL> alter session set container=pdb11;
Session altered.
SQL> grant create pluggable database to system;
Grant succeeded.
SQL>
In CDB "orcl2":
While connected to the CDB$ROOT:
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
SQL>
Creating a Database Link in "orcl2" poiting to the pdb "pdb11" in cdb "orcl":
SQL> create database link cdb_orcl1 connect to system identified by system using '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=pdb11)))';
Database link created.
Clonning the PDB into "orcl" CDB:
SQL> create pluggable database pdb11_clone from pdb11@cdb_orcl1 file_name_convert=('pdb11','pdb11_clone') parallel 3;
Pluggable database created.
SQL>
Opening the PDB in "orcl" CDB:
SQL> alter pluggable database pdb11_clone open;
Pluggable database altered.
Checking that the PDB was successfully cloned:
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB11_CLONE READ WRITE NO