Convert the upgraded 12c database to PDB !!!

Home »  12c »  Convert the upgraded 12c database to PDB !!!

On January 22, 2016, Posted by , In 12c,ORACLE, By , , With No Comments

This article is a continuation to our previous article where we have upgraded 11gR2 database to 12c database. In this article, we will see the steps to convert the upgraded 12c database to PDB.

======================================================================================================

 

Follow the below steps to convert to PDB.

• Create a container database

If the upgraded database is the only database on the current system, then you need to create a Container Database (CDB) first using dbca. Once the CDB is created you can proceed with the next step.

 

• Plugin the upgraded database into the container database

The first thing we need to do is to connect to the non-CDB, and run the DBMS_PDB.DESCRIBE procedure to construct an XML file that contains the metadata which describes the non-CDB. We need to run this procedure while the database is in a read only mode.

– Open the database in Read-only mode and execute the procedure

 

– Connect to CDB and plug in to CDB by converting it to a PLUGGABLE DATABASE.

$ export ORACLE_SID=contdb
$ sqlplus / as sysdba

SQL> CREATE PLUGGABLE DATABASE orcldb using ‘/u01/app/oracle/orcldb.xml’ nocopy tempfile reuse;

Pluggable database created.

The XML file accurately describes the current locations of the files of the PDB
Since we are using the existing 12c non-CDB datafiles to create the CDB pluggable database, we have used the NOCOPY option.

 

– Check the status of database

We can see that orcldb database is now a PDB and it’s in a mounted state.

SQL> select PDB_NAME, DBID, CON_ID, STATUS from CDB_PDBS;

PDB_NAME DBID CON_ID STATUS
———— ———- ———- ———
PLUGDB 501047309 3 NORMAL
PDB$SEED 4038560532 2 NORMAL
ORCLDB 2329086960 4 NEW

SQL> show con_name

CON_NAME
——————————
CDB$ROOT

SQL> ALTER SESSION SET CONTAINER=orcldb;

Session altered.

SQL> show con_name;

CON_NAME
——————————
ORCLDB

 

– Run the “noncdb_to_pdb.sql” script and open the database

This script must be run before the new PDB can be opened for the first time.

SQL> @?/rdbms/admin/noncdb_to_pdb.sql

After the script has been run open the PDB orcldb in READ WRITE mode.

You can see from output that the database is now opened in read write mode.

That’s it, this completes our activity of converting the upgraded database to a PDB database.

======================================================================================================

Tags : , ,

Leave a Reply

Your email address will not be published. Required fields are marked *