NON-CDB DB -NAME -> NONCDB
CDB DB NAME ->NONCDB
STEPS:
1. Open the non-cdb database in read only mode:
SQL> select name from v$database; NAME---------NONCDB SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL> startup open read onlyORACLE instance started.Total System Global Area 1.8119E+10 bytesFixed Size 7641528 bytesVariable Size 1.0133E+10 bytesDatabase Buffers 7851737088 bytesRedo Buffers 126574592 bytesDatabase mounted.Database opened.SQL> select name,open_mode from v$database;NAME OPEN_MODE--------- --------------------NONCDB READ ONLY
2. Check the compatibility of PDB on ( NONCDB)
3. Shutdown the NON-CDB database ( NONCDB)
SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL> exit4. Now connect to the container database, where it need to be plugged.
SET SERVEROUTPUT ON;DECLAREcompatible CONSTANT VARCHAR2(3) := CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(pdb_descr_file => '/export/home/oracle/NonCDB.xml')WHEN TRUE THEN 'YES'ELSE 'NO'END;BEGINDBMS_OUTPUT.PUT_LINE(compatible);END;/5. Check the violations:
select name,cause,type,message,status from PDB_PLUG_IN_VIOLATIONS where name='NONCDB'; NAME CAUSE TYPE-------------------- -------------------- ---------MESSAGE STATUS----------------------------------- ---------NONCDB Non-CDB to PDB WARNINGPDB plugged in is a non-CDB, PENDINGrequires noncdb_to_pdb.sql be run. NONCDB Parameter WARNINGCDB parameter memory_target PENDINGmismatch: Previous 17280M Current13856M6. Create pluggable database
SQL> create pluggable database NONCDB using '/export/home/oracle/NonCDB.xml' NOCOPY;create pluggable database NONCDB using '/export/home/oracle/NonCDB.xml' NOCOPY*ERROR at line 1:ORA-27038: created file already existsORA-01119: error in creating database file '/archive/NONCDB/temp01.dbf' --- As tempfile is already there, so mention tempfile reuse tag, to avoid this error. SQL> create pluggable database NONCDB using '/export/home/oracle/NonCDB.xml' NOCOPY tempfile reuse; Pluggable database created.7 . Run the noncdb_to_pdb.sql script
ALTER SESSION SET CONTAINER=NONCDB; @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql8. Open the PDB:
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; NAME OPEN_MODE-------------------- ----------PDB$SEED READ ONLYPDB1 READ WRITEPDB2 READ WRITENONCDB READ WRITE