CONVERT NON-CDB TO PDB ON SAME Server
###################################################################################
CONVERT NON-CDB TO PDB ON SAME Server and DB version
Non Container DB name :- NONCONDB
Non Container DB Instance :- NONCONDB1 and NONCONDB2
Container DB name :- CONDB
Container DB Instance :- CONDB1 and CONDB2
Pluggable DB :- PGDB01
###################################################################################
--------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
Go to Non Container DB NONCONDB and then follow below steps
---------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
1. connect Non CDB as sysdba
export ORACLE_SID=NONCONDB1
sqlplus / as sysdba
2. Stop DB
SHUTDOWN IMMEDIATE;
3. Start DB in Read Only mode.
STARTUP OPEN READ ONLY;
4. Execute below in non-container DB NONCONDB to create xml file
(Describe the non-DBC using the DBMS_PDB.DESCRIBE procedure)
BEGIN
DBMS_PDB.DESCRIBE(
pdb_descr_file => '/home/oracle/NONCONDB.xml');
END;
/
5. Stop Non-CDB
SHUTDOWN IMMEDIATE;
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
Go to Container DB CONDB and then follow below steps
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
1. connect CDB as sysdba
export ORACLE_SID=CONDB1
sqlplus / as sysdba
2. create a new PDB using the file describing the non-CDB database
(Execute Any one out of below)
CREATE PLUGGABLE DATABASE PGDB01 USING '/home/oracle/NONCONDB.xml'
COPY
FILE_NAME_CONVERT = ('/u02/app/oracle/oradata/datNONCONDB/NONCONDB/NONCONDB/datafile/', '/u02/app/oracle/oradata/datCONDB/CONDB/CONDB/datafile/PGDB01/');
OR
CREATE PLUGGABLE DATABASE PGDB01 USING '/home/oracle/NONCONDB.xml'
MOVE
FILE_NAME_CONVERT = ('/u02/app/oracle/oradata/datNONCONDB/NONCONDB/NONCONDB/datafile/', '/u02/app/oracle/oradata/datCONDB/CONDB/CONDB/datafile/PGDB01/');
3. Switch to the PDB container and run the "$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql"
ALTER SESSION SET CONTAINER=PGDB01;
@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
4. Startup the PDB and check the open mode.
ALTER SESSION SET CONTAINER=PGDB01;
ALTER PLUGGABLE DATABASE OPEN;
5. Restart DB Container DB.... connect CDB as sysdba
export ORACLE_SID=CONDB1
sqlplus / as sysdba
SHUTDOWN IMMEDIATE;
STARTUP ;
GOT ERROR, If any oracle managed TEMP file in Non-CDB then that needs to be dropped and recreated to fix it.
CREATE TEMPORARY TABLESPACE TEMP TEMPFILE '/u02/app/oracle/oradata/datCONDB/CONDB/CONDB/datafile/temp01.dbf' SIZE 2000M;
CONVERT NON-CDB TO PDB ON SAME Server and DB version
Non Container DB name :- NONCONDB
Non Container DB Instance :- NONCONDB1 and NONCONDB2
Container DB name :- CONDB
Container DB Instance :- CONDB1 and CONDB2
Pluggable DB :- PGDB01
###################################################################################
--------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
Go to Non Container DB NONCONDB and then follow below steps
---------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
1. connect Non CDB as sysdba
export ORACLE_SID=NONCONDB1
sqlplus / as sysdba
2. Stop DB
SHUTDOWN IMMEDIATE;
3. Start DB in Read Only mode.
STARTUP OPEN READ ONLY;
4. Execute below in non-container DB NONCONDB to create xml file
(Describe the non-DBC using the DBMS_PDB.DESCRIBE procedure)
BEGIN
DBMS_PDB.DESCRIBE(
pdb_descr_file => '/home/oracle/NONCONDB.xml');
END;
/
5. Stop Non-CDB
SHUTDOWN IMMEDIATE;
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
Go to Container DB CONDB and then follow below steps
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
1. connect CDB as sysdba
export ORACLE_SID=CONDB1
sqlplus / as sysdba
2. create a new PDB using the file describing the non-CDB database
(Execute Any one out of below)
CREATE PLUGGABLE DATABASE PGDB01 USING '/home/oracle/NONCONDB.xml'
COPY
FILE_NAME_CONVERT = ('/u02/app/oracle/oradata/datNONCONDB/NONCONDB/NONCONDB/datafile/', '/u02/app/oracle/oradata/datCONDB/CONDB/CONDB/datafile/PGDB01/');
OR
CREATE PLUGGABLE DATABASE PGDB01 USING '/home/oracle/NONCONDB.xml'
MOVE
FILE_NAME_CONVERT = ('/u02/app/oracle/oradata/datNONCONDB/NONCONDB/NONCONDB/datafile/', '/u02/app/oracle/oradata/datCONDB/CONDB/CONDB/datafile/PGDB01/');
3. Switch to the PDB container and run the "$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql"
ALTER SESSION SET CONTAINER=PGDB01;
@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
4. Startup the PDB and check the open mode.
ALTER SESSION SET CONTAINER=PGDB01;
ALTER PLUGGABLE DATABASE OPEN;
5. Restart DB Container DB.... connect CDB as sysdba
export ORACLE_SID=CONDB1
sqlplus / as sysdba
SHUTDOWN IMMEDIATE;
STARTUP ;
GOT ERROR, If any oracle managed TEMP file in Non-CDB then that needs to be dropped and recreated to fix it.
CREATE TEMPORARY TABLESPACE TEMP TEMPFILE '/u02/app/oracle/oradata/datCONDB/CONDB/CONDB/datafile/temp01.dbf' SIZE 2000M;
Comments
Post a Comment