Adopting NON-CDB to CBD

This article describe steps to Adopt non-container database 12c to container 12c 

[oracle@test12c Desktop]$ ps -ef | grep pmon

oracle    3230     1  0 04:04 ?        00:00:09 ora_pmon_db12c
oracle   12112     1  0 08:20 ?        00:00:07 ora_pmon_NonCDB
oracle   29621  3203  0 18:47 pts/1    00:00:00 grep pmon

Where :
db12c : Container database
NonCDB : Non Container Database
Let Start

[oracle@test12c Desktop]$ export ORACLE_SID=NonCDB

SQL> select instance_name from v$instance ;
INSTANCE_NAME
—————-
NonCDB

SQL> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount exclusive
ORACLE instance started.
Total System Global Area  939495424 bytes
Fixed Size    2295080 bytes
Variable Size  348130008 bytes
Database Buffers  583008256 bytes
Redo Buffers    6062080 bytes
Database mounted.

SQL> alter database open read only;

Database altered.

Run the below procedure to generate the manifest file. 

SQL> exec dbms_pdb.describe(pdb_descr_file=>’/u01/noncdb.xml’);

PL/SQL procedure successfully completed.

SQL> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.

 I already working on the same host so no need to copy datafiles,if you are not working on same host copy datafiles to same location.

Let’s Work On Container Database .

after copy datafiles to folder, On Os Level , Create directory to use file_name_convert.

[oracle@test12c oradata]$ mkdir newnoncdb
[oracle@test12c newnoncdb]$ pwd
/u01/app/oracle/oradata/newnoncdb

[oracle@test12c Desktop]$ export ORACLE_SID=db12c
[oracle@test12c Desktop]$ sqlplus / as sysdba

 

SQL> create pluggable database non_cdb as clone
  2  using ‘/u01/noncdb.xml’
  3  file_name_convert=(‘/u01/app/oracle/oradata/NonCDB’,’/u01/app/oracle/oradata/newnoncdb’) copy;

Pluggable database created.

 Where

  1.  using ‘/u01/noncdb.xml’ : file that should be generated using dbms_pdb.describe
  2. ‘/u01/app/oracle/oradata/NonCDB’ : location for Copied Non_CDB datafile
  3. ,’/u01/app/oracle/oradata/newnoncdb’ : location for created directory.

SQL> alter pluggable database non_cdb open ;        
Pluggable database altered.

SQL> alter pluggable database non_cdb close ;
Pluggable database altered.

SQL> alter pluggable database non_cdb open ;
Pluggable database altered.

NAME       OPEN_MODE
—————————— ———-
PDB$SEED       READ ONLY
NEWDB_PLUG MOUNTED
NEW_PLUG_COPY MOUNTED
NEW_PLUG_MOVE MOUNTED
NON_CDB       READ WRITE

Now you plugged NON-CDB to Container Database successfully without any problems and it will works fine.
the below step is optional but recommanded for production to move all thing from non-cdb to cdb. ( specially for upgrade 12c later ) 

SQL> alter session set container=Non_cdb;
Session altered.

OR 

[oracle@test12c newnoncdb2]$ sqlplus sys/sys@test12c:1521/Non_cdb as sysdba  ;

SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql   

Thank you
Osama Mustafa

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.