12C Non CDB To CDB
12C Non CDB To CDB
CDB
---
NO
Step 2
On the source non-CDB, check the datafiles location and shut down the non-CDB database:
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ORCL/system01.dbf
/u01/app/oracle/oradata/ORCL/sysaux01.dbf
/u01/app/oracle/oradata/ORCL/undotbs01.dbf
/u01/app/oracle/oradata/ORCL/users01.dbf
vi db12201.xml
-- look for "<path>" and edit
<path>/u01/app/oracle/oradata/ORCL/users01.dbf</path>
-- to
<path>/<target/users01.dbf</path>
-- repeat for all datafiles
Step 3
On the target CDB, check the compatibility of the non-CDB to be plugged in as PDB:
NO
PL/SQL procedure successfully completed.
Connect to the target CDB and create a new PDB using the XML file describing the
non-CDB database.
Session altered.
SQL> select name from v$datafile;
NAME
----------------------------------------------------------------------------------------------------
+DATA/CDB_FRA/D8ABE7903A33E0533700000A9D8ABE790D11A214/DATAFILE/
system.280.9331710682
+DATA/CDB_FRA/D8ABE7903A33E0533700000A9D8ABE790D11A214/DATAFILE/
sysaux.278.9331710682
+DATA/CDB_FRA/D8ABE7903A33E0533700000A9D8ABE790D11A214/DATAFILE/
undotbs1.279.9331710682
+DATA/CDB_FRA/D8ABE7903A33E0533700000A9D8ABE790D11A214/DATAFILE/
users.277.9331710682
Step 4
In case your target CDB is at a higher release level (e.g. source is 18c and target is 19c), then
now it’s the time to upgrade the newly created PDB. Use AutoUpgrade or execute the
following commands:
Step 5
The plugged in non-CDB (the new PDB) still contains some objects in the data
dictionary that does not belong to a PDB and hence need to be removed. This is
done by executing the noncdb_to_pdb.sql script from within the PDB:
The script also automatically runs the utl_recomp.recomp_parallel procedure, which could
take a while to complete.
Session altered.
SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
Step 6
The patching related errors indicates having patches in the CDB, but not in the PDB, so we
need to run datapatch for the PDB. This would also be the case when the CDB is at a higher
patch level than the original non-CDB.
$ORACLE_HOME/OPatch/datapatch -verbose -pdbs TRGTCDB
...
Patch 31772700 apply (pdb TRGTCDB): SUCCESS
logfile:
-- check
SQL> alter pluggable database TRGTCDB close immediate;
Step 7
Encrypt the USERS tablespace. Encrypting the SYSTEM and SYSAUX tablespaces is
usually not needed as they should not contain any application data. But let’s do it
anyway to demonstrate getting rid of the above warnings:
Tablespace altered.
Tablespace altered.
Tablespace altered.
Last check:
no rows selected
Done !!