In this article, I’m going to show you how to convert a NON-CDB database into cdb database. Convert non-container database to multitenant pluggable database with Oracle Database 12c Enterprise Edition Release 126.96.36.199.0 – 64bit.
Run the following commands on both machines.
SQL> select * from v$version; SQL>select dbid,name,cdb from v$database;
Output from Non-CDB database
Output from CDB database
SQL>select pdb_id,dbid,pdb_name,status from cdb_pdbs;
Output from CDB database
Run the following commands on the Non-CDB database step by step.
SQL>shut immediate SQL>startup mount exclusive SQL>alter database open read only; SQL>exec dbms_pdb.describe (pdb_descr_file=>'/u01/aarav.xml'); SQL>shutdown immediate
Run the following commands on the CDB database step by step
SQL>startup SQL>SET SERVEROUTPUT ON; SQL>DECLARE Compatible CONSTANT VARCHAR2(3) :=CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY (pdb_descr_file => '/u01/aarav.xml') WHEN TRUE THEN 'YES' ELSE 'NO' END; BEGIN DBMS_OUTPUT.PUT_LINE(compatible); END; /
After running the above code then check the Violations, if any.
SQL>select name, cause, type, message, status FROM PDB_PLUG_IN_VIOLATIONS WHERE name='AARAV';
Note:- In the above query it’s showing two warnings, these warnings can be safely ignored.
Create a pluggable database with any name using the following command.
SQL>CREATE PLUGGABLE DATABASE pdb12c USING '/u01/aarav.xml' COPY FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/aarav', '/u01/app/oracle/oradata/pdb12c');
Set your session with the newly created pluggable database using the following command.
SQL>alter session set container=pdb12c;
Now it’s finally time to migrate a non-CDB database to a CDB database, just run the following script.
Note:- The above script takes a few minutes in execution, so don’t panic.
After completing the above script, now you can open the newly pluggable database, using the following command.
SQL>alter pluggable database open;
Now you can check your database name and open mode using the following command.
SQL>select name, open_mode FROM v$pdbs;
When you convert a non-CDB database to a CDB pluggable database, you can choose from several options depending upon the size of the database.
If the database is very large, you might use the NOCOPY option. This minimizes the amount of extra space needed and reduces the time it takes to perform the conversion operation. The NOCOPY option is risky, however, because you don’t keep the original database files intact. Thus, if you need to restore the database to the previous state, you must restore the database using the backups taken before the conversion activity.
If the database size is smaller, you should use the COPY option so that, if there are any issues, the fallback to the old non-CDB is straightforward because the original files are always intact.
Our Latest Posts:
- Upgrade Oracle 11g to 19c using AutoUpgrade utility
- Check the Patch Applied to the Oracle Database
- Tablespace Utilization In Oracle Multitenant Database
- Delete RMAN Backups
- How to Configure Recovery Catalog
Connect with me on: