Multitenant Converting NON-CDB to a PDB Database 12c

Hello everyone!

On this post I will show how to convert your Non-Container Database (CDB) to a Pluggable database (PDB).
This steps make part of the architecture of multitenant available on 12c

Let’s start:

This is my database in NON-CDB database:

SQL> select name, cdb from v$database;

NAME        CDB
——-           —
DBUPGR    NO

This is my database files:

SQL> select name from v$datafile;

NAME
————————————————–
/u01/app/oracle/oradata/DBUPGR/undotbs01.dbf
/u01/app/oracle/oradata/DBUPGR/users01.dbf
/u01/app/oracle/oradata/DBUPGR/example01.dbf
/u01/app/oracle/oradata/DBUPGR/dfupgr01.dbf
/u01/app/oracle/oradata/DBUPGR/system01.dbf
/u01/app/oracle/oradata/DBUPGR/sysaux01.dbf

Shut down the database and then, open in read only mode and execute the dbms_pdb.

SQL> shutdown immediate;

SQL> startup mount;

SQL> alter database open read only;

SQL> exec dbms_pdb.describe (PDB_DESCR_FILE=>’/u01/app/oracle/oradata/DBUPGR/dbupgr.xml’);

SQL> shutdown immediate;

Now connect in your container database:

[oracle@srvhost1 ~]$ export ORACLE_SID=CDB1
[oracle@srvhost1 ~]$ sqlplus / as sysdba

SQL>CREATE PLUGGABLE DATABASE DBUPGR USING ‘/u01/app/oracle/oradata/DBUPGR/dbupgr12c.xml’
COPY
FILE_NAME_CONVERT = (‘/u01/app/oracle/oradata/DBUPGR/’, ‘/u01/app/oracle/oradata/CDB1/DBUPGR/’);

Pluggable database created.

Run the script below, this script will model the (now) pluggable database.

SQL> ALTER SESSION SET CONTAINER=DBUPGR;

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

And finally open your PDB.

SQL> ALTER SESSION SET CONTAINER=DBUPGR;

SQL> ALTER PLUGGABLE DATABASE OPEN;

SELECT name, open_mode FROM v$pdbs;

NAME               OPEN_MODE
——————– ———-
DBUPGR           READ WRITE

1 row selected.

I hope that you enjoy!

Cheers!

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s