Below are the steps how to clone a pluggable database from another container. The steps are used during a migration from 12.1 to 12.2, but will also work for later releases.
- Create a Database link in the target container
Create a database link in the ROOT container and validate the link.
Perform the action in the target container.
SQL> select owner,db_link,host from dba_db_links;
SQL> create public database link tcdb01_LNK connect to system identified by yourpassword using 'tcdb01'; SQL> select db_unique_name from v$database@tcdb01_LNK;
- Clone pluggable database using database link
SQL> create pluggable database tpdb from tpdb@tcdb01_LNK standbys=NONE;
Pluggable database created.
In case of a standby we define the standbys=NONE clause, as in that case we want to update the standby in a later case.
Above is an example without any file name convertion.
In case you required to use file_name_convert the statement will look like this:
$ mkdir /u01/app/oracle/oradata/TPDB
SQL> create pluggable database TPDB from TPDB@tcdb01_LNK standbys=none file_name_convert=('/u01/app/oracle/oradata/TPDB_11','/u01/app/oracle/oradata/TPDB');
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 4 TPDB MOUNTED
In case the pluggable is coming from an other release a upgrade is required.
- Open the pluggable database migrate
SQL> alter pluggable database tpdb open upgrade; Pluggable database altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ------- ------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 4 TPDB MIGRATE YES
- Upgrade the pluggable database
From the new ORACLE_HOME execute catctl using catupgrd.sql
$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catctl.pl –c "TPDB" $ORACLE_HOME/rdbms/admin/catupgrd.sql
- Start pluggable database
SQL> alter session set container=tpdb; Session altered. SQL> startup Pluggable Database opened. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ------- ------------------------ ---------- ---------- 4 TPDB READ WRITE NO
SQL>@?/rdbms/admin/utlrp.sql
- Check options for the pluggable
SQL> select name,status,action,message from PDB_PLUG_IN_VIOLATIONS where cause='OPTION';
NAME STATUS ACTION MESSAGE -------------------------------------------------- PENDING Fix the database option in the PDB or the CDB Database option RAC mismatch: PDB installed version 12.1.0.2.0. CDB installed version NULL.
SQL> alter session set container=pluggable_name; SQL> exec dbms_registry.OPTION_OFF('RAC'); SQL> shutdown immediate SQL> startup
SQL> col name for a15SQL> col status for a10
SQL> select name,status,action,message from PDB_PLUG_IN_VIOLATIONS where cause='OPTION' and status <> 'RESOLVED' and name <> 'PDB$SEED';