Upgrade the Non-CDB to PDB in a CDB Environment Oracle 12c

Upgrade the Non-CDB to PDB in a CDB Environment Oracle 12c

We are going to upgrade the 12.1.0.1 Non-cdb database as a PDB in 12.2.0.1 Container Database.

Note:
1. Database Non-CDB 12.1.0.1 (or lower version) version first upgrade to the 12.2.0.1 version NON-CDB database. Then it converted to PDB.
Follow link for upgrade the lower version of Non cdb to upper version on Non CDB
2. After upgrade Patches set must be same for both 12.2 version before start upgrade check the patch applied.
3. Apex configuration must be checked before otherwise it will give error.

Following are the Steps of converting NON-CDB Same version database to PDB

1. Install the new version 12.2.0.1 database as CDB.

2. Set the compatibility of CDB database as 12.0.0

3. Open the database in read only mode of 12.1 version which going to upgrade as pdb

Shutdown immediate;
startup mount;
alter database open read only;

4. Create XML file for database, file XML name must be the name of PDB.

exec DBMS_PDB.DESCRIBE('path/myPDB.xml');

exec DBMS_PDB.DESCRIBE('/home/oracle/PDB2.xml');

5. Shutdown the soruce database

Shutdown immediate;

6. Set the New oracle home of 12.2 version.

7. Run the DBMS_PDB.CHECK_PLUG_COMPATIBILITY test.

set serveroutput on
DECLARE
compatible CONSTANT VARCHAR2(3) :=
CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
pdb_descr_file => '/home/oracle/PDB2.xml',
pdb_name => 'PDB2')
WHEN TRUE THEN 'YES'
ELSE 'NO'
END;
BEGIN
DBMS_OUTPUT.PUT_LINE(compatible);
END;

Note:
If output is YES, then the PDB is compatible.
If output is NO, then PDB_PLUG_IN_VIOLATIONS view to see why it is not compatible.

8. Create the database as pluggable in container database of 12.2 version.

CREATE PLUGGABLE DATABASE pdb2 USING '/home/oracle/pdb2.xml' NOCOPY TEMPFILE REUSE;

Note:
NOCOPY means location of files is same as old.
TEMPFILE REUSE means temp file old is used again.

9. Connect to the PDB database.

ALTER SESSION set container=pdb2;

10. Must run the script before open the pdb2 database for convert noncdb to pdb dictionary

@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

11. Startup the PDB database in read write mode.

alter pluggable database pdb2 close;
alter pluggable database pdb2 open;
alter pluggable database pdb2 save state;

12. Backup the PDB2 database with RMAN.

Advertisements

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.