Convert Non CDB Database To PDB Database In Oracle 12c

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarKiran Dalvi
  • 31 Aug, 2023
  • 0 Comments
  • 1 Min Read

Convert Non CDB Database To PDB Database In Oracle 12c

Convert Non CDB Database To PDB Database In Oracle 12c

The procedures for converting an Oracle non-CDB/PDB database to a PDB database are listed below. i.e Plugging a normal 12c non pdb database to a container database.

DB Name :

NON-CDB DB -NAME : – NONCDB

CDB DB NAME : – PRIM

1. Open the non-cdb database in read only mode:
SQL> select name from v$database;
SQL> shutdown immediate;
SQL> startup open read only
SQL> select name,open_mode from v$database;
  1. Check the compatibility of PDB on ( NONCDB)
 
BEGIN
DBMS_PDB.DESCRIBE(pdb_descr_file => '/export/home/oracle/NonCDB.xml');
END;
/

PL/SQL procedure successfully completed.

  1. shutdown NON-CDB database ( NONCDB)
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Now connect to the container database, where it need to be plugged.
SET SERVEROUTPUT ON;
DECLARE
compatible CONSTANT VARCHAR2(3) := CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(pdb_descr_file => '/export/home/oracle/NonCDB.xml')
WHEN TRUE THEN 'YES'
ELSE 'NO'
END;
BEGIN
DBMS_OUTPUT.PUT_LINE(compatible);
END;
/

  1. Check the violations:
select name,cause,type,message,status from PDB_PLUG_IN_VIOLATIONS where name='NONCDB';
  1. Create pluggable database ( PRIM)
SQL> create pluggable database NONCDB using '/export/home/oracle/NonCDB.xml' NOCOPY tempfile reuse;
7 . Run the noncdb_to_pdb.sql script
ALTER SESSION SET CONTAINER=NONCDB;

@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

  1. Open the PDB:
SQL> ALTER PLUGGABLE DATABASE OPEN;

Pluggable database altered.

SQL> SELECT name, open_mode FROM v$pdbs;


NAME OPEN_MODE
-------------------- ----------
NONCDB READ WRITE

1 row selected.


SQL> select name,open_mode from v$pdbs;