Version of Non-CDB database = 12.2.0.1.0
Version of CDB database = 12.2.0.1.0
Following steps will plug-in non-cdb database into cdb as pdb.
My non-cdb database name is confdb
My cdb database name is imadb
1) Open non-cdb database in read-only mode to create XML file for the PDB.
- Shutting down non-cdb database (confdb)
TESTING:oracle $ export ORACLE_SID=confdb TESTING:oracle $ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Thu Feb 15 06:34:47 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down.
- Mounting the database and opening in read-only
SQL> startup mount ORACLE instance started. Total System Global Area 1006632960 bytes Fixed Size 8628160 bytes Variable Size 322963520 bytes Database Buffers 666894336 bytes Redo Buffers 8146944 bytes Database mounted. SQL> alter database open read only; Database altered.
- CREATE XML FILE FOR PDB
SQL> exec DBMS_PDB.DESCRIBE('/home/oracle/depconfdb.xml'); PL/SQL procedure successfully completed.
2) Shutdown non-cdb database.
TESTING:oracle $ export ORACLE_SID=imadb TESTING:oracle $ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Thu Feb 15 06:34:47 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down.
3)Plugin non-cdb database as pdb into new cdb
- Running following command on CDB database – imadb
SQL>CREATE PLUGGABLE DATABASE confdb USING '/home/oracle/depconfdb.xml' NOCOPY TEMPFILE REUSE;
4)Convert the dictionary of new pluggable database to PDB type.
- Change the container to new pluggable database and run the script
SQL>ALTER SESSION set container=confdb; Session altered. SQL>@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
5)Start New Pluggable database.
SQL> alter pluggable database confdb open; Pluggable database altered.
- If there is some errors on above mentioned you can use this view to get information
SQL>select name,cause,type,message,status from PDB_PLUG_IN_VIOLATIONS where name = 'CONFDB' and status != 'RESOLVED';