12c: How to convert non-CDB to CDB.

#1 How to convert non-CDB to CDB.

In this article `ll go through whole process of changing our non-CDB database to CDB.

Process of converting non-CDB to CDB can be done (according to Oracle documentation) can be done using following methods:

  1. Upgrading our pre 12c database to 12c database and then plug it into new CDB database
  2. Using Oracle Data Pump or Golden Gate

In this article `ll cover the first one, the second approach is good for small databases or if we want to keep our source database open.

Let`s start from some basic information about db that i`m using:

  1. OLDDB – this is SID for my non-CDB pre 12c database which i`m going to convert to CDB database or should i say plugg into CDB
  2. O12CDB – this is SID for my newly created CDB database

NOTE.

I assumed that O12CDB is already setup and running, you can do this either by using DBCA or like a true dba using SQL*Plus.


 

Ok so this is everything we should now so far, eveything else will be cover next in this article.

 

MAKING OUR NON-CDB, CDB

  1. Upgrade your non-cdb database (OLDDB) to Oracle 12c
  2. Prepare metadata for OLDDB (on 12c software)
  3. Make XML and datafile avaliable to O12CDB.
  4. Plugging OLDDB into O12CDB

Ad 1. Upgrade your non-cdb database (OLDDB) to Oracle 12c

I recommended that OLDDB should be upgrade at least 11.2.0.3 because from this version we can direct upgrade our db further to 12c.

NOTE.

You can check your db version either by connecting to SQL*Plus or by quering v$version fixed view. Also you can find more information about upgrade on this Oracle white papper (http://www.oracle.com/technetwork/database/upgrade/upgrading-oracle-database-wp-12c-1896123.pdf).

Upgrade can be done using DBUA, first you install software into different $ORACLE_HOME and then you run dbua from new $ORACLE_HOME.


 

Ad 2. Prepare metadata for OLDDB (on 12c software)

Okej so now one we have OLDDB up and running using 12c software.

First we need to put our database into read-write mode.

shutdown immediate;

startup mount;

alter database open read write;

Next we`ll be generating XML, this can be accomplished using DBMS_PDB package and DESCRIBE function.

EXEC DBMS_PDB.DESCRIBE(pdb_descr_file=>&file_name_for_our_manifest)

/

Now we shut down our OLDDB database.

Ad 3. Make XML and datafile avaliable to O12CDB.

If you plan to copy database to new host make this files avaliable to new host.

NOTE

If you upgrade your non-CDB to CDB on the same host remamber of setting $ORACLE_SID and $ORACLE_HOME correct depending to which database you plan to connect!

Ad 4. Plugging OLDDB into O12CDB

We`ve to start our process of plugging non-CDB database to container from executing following code:

CREATE PLUGGABLE DATABASE <new-name> 

USING <path-to-XML>

FILE_NAME_CONVERT=(‘FRv$OM’,’TO’)

COPY|NOCOPY;

Be carefull if you use COPY you should have at least the same as sum of your non-CDB datafiles in your system (of course it is upper bound, because for example UNDO want be copied, because UNDO is for whole CDB database, not individual PDB`s).

Also in my expirience I found out that datafiles need to be in the same path as if there`re in XML file unless Oracle bump into error. We can ommit this error by manualy changing path`s in XML and using NOCOPY option.

After this process you can veryfy that our source DB is now in CDB as pluggable databaes by querying v$pdbs fixed view.

Afer all you have to also run the noncdb_to_pdb.sql script from newly created PDB.

 

Leave a comment