Upgrade PDB using unplug/plug to 12.1.0.2


puz1

In this post I want to describe the steps needed to upgrade a PDB from 12.1.0.1 to 12.1.0.2 using the unplug and plugin method. There is also a way where you can make a full CDB upgrade, but this is not the focus of this post.

Enviornment:

source CDB 12.1.0.1 => ECDB1
source PDB 12.1.0.1 => EPDB1
target CDB  12.1.0.2 => ECDB2

First we must prepare the pluggable database for unplugging from the source Container Database. Ensure that the pluggable database is open.

To get the current status of your PDBs you can query the v$pdbs View

SQL> select name,open_mode from v$pdbs;

NAME                            OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
EPDB1                          READ WRITE

Next start the preupgrd.sql script which checks the pre upgrade requirements and also generates fixup SQL scripts.

SQL> alter session set container=EPDB1;

Session altered.

SQL> @?/rdbms/admin/preupgrd.sql
Loading Pre-Upgrade Package...
Executing Pre-Upgrade Checks...
Pre-Upgrade Checks Complete.
      ************************************************************

Results of the checks are located at:
 /u01/app/oracle/cfgtoollogs/ECDB1/preupgrade/preupgrade.log

Pre-Upgrade Fixup Script (run in source database environment):
 /u01/app/oracle/cfgtoollogs/ECDB1/preupgrade/preupgrade_fixups.sql

Post-Upgrade Fixup Script (run shortly after upgrade):
 /u01/app/oracle/cfgtoollogs/ECDB1/preupgrade/postupgrade_fixups.sql

      ************************************************************

     Fixup scripts must be reviewed prior to being executed.

      ************************************************************

      ************************************************************
           ====>> USER ACTION REQUIRED    <<====
      ************************************************************

 The following are *** ERROR LEVEL CONDITIONS *** that must be addressed
            prior to attempting your upgrade.
        Failure to do so will result in a failed upgrade.


 1) Check Tag:      OLS_SYS_MOVE
    Check Summary: Check if SYSTEM.AUD$ needs to move to SYS.AUD$ before upgrade
    Fixup Summary:
     "Execute olspreupgrade.sql script prior to upgrade."
    +++ Source Database Manual Action Required +++

        You MUST resolve the above error prior to upgrade

      ************************************************************

Start the fixups and also any manual action that is Required.

SQL>@/u01/app/oracle/cfgtoollogs/ECDB1/preupgrade/preupgrade_fixups.sql

After running all steps you can close the PDB on all active instances (in case of RAC) and unplug it from the source CDB.

SQL> alter session set container=CDB$ROOT;
Session altered.

SQL> alter pluggable database EPDB1 close;
Pluggable database altered.

SQL> alter pluggable database EPDB1 unplug into '/u01/app/oracle/stage/epdb1.xml';
Pluggable database altered.

SQL> exit

Start an SQL*Plus session on your new Container Database (in my case ECDB2). You can do a plugin check but I will fail because the compatible parameter of the new CDB database is 12.1.0.2 but obviously the plugin operation will work.

SQL> alter session set container=CDB$ROOT;
Session altered.

SQL> SET SERVEROUTPUT ON
DECLARE
  compatible CONSTANT VARCHAR2(3) := CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
  pdb_descr_file => '/u01/app/oracle/stage/epdb1.xml',
  pdb_name => 'EPDB1')
  WHEN TRUE THEN 'YES' ELSE 'NO'
END;
BEGIN
DBMS_OUTPUT.PUT_LINE(compatible);
END;
/ 
NO

SQL> select message, status from pdb_plug_in_violations where type like '%ERR%';
PDB's version does not match CDB's version: PDB's version 12.1.0.0.0. CDB's version 12.1.0.2.0

SQL> create pluggable database EPDB1 using '/u01/app/oracle/stage/epdb1.xml';
Pluggable database created.

SQL> alter pluggable database EPDB1 open upgrade;
Warning: PDB altered with errors

The open command will return a Warning message because the upgrade process is not done here. You can check the pdb_plug_in_violations view for more information.

On the command prompt change your directory to $ORACLE_HOME/rdbms/admin. The catctl.pl command will start the upgrade process of the PDB database.

[oracle@server1 #]$ cd $ORACLE_HOME/rdbms/admin
[oracle@server1 #]$ $ORACLE_HOME/perl/bin/perl catctl.pl -c "EPDB1" -l /home/oracle/upgrade catupgrd.sql
Argument list for [catctl.pl]
SQL Process Count     n = 2
SQL PDB Process Count N = 0
Input Directory       d = 0
Phase Logging Table   t = 0
Log Dir               l = /home/oracle/upgrade
Script                s = 0
Serial Run            S = 0
Upgrade Mode active   M = 0
Start Phase           p = 0
End Phase             P = 0
Log Id                i = epdb1
Run in                c = EPDB1
Do not run in         C = 0
Echo OFF              e = 1
No Post Upgrade       x = 0
Reverse Order         r = 0
Open Mode Normal      o = 0
Debug catcon.pm       z = 0
Debug catctl.pl       Z = 0
Display Phases        y = 0
Child Process         I = 1

catctl.pl version: 12.1.0.2.0
Oracle Base           = /u01/app/oracle

Analyzing file catupgrd.sql
Log files in /home/oracle/upgrade
catcon: ALL catcon-related output will be written to /home/oracle/upgrade/catupgrdepdb1_catcon_9942.lst
catcon: See /home/oracle/upgrade/catupgrdepdb1*.log files for output generated by scripts
catcon: See /home/oracle/upgrade/catupgrdepdb1_*.lst files for spool files, if any
Number of Cpus        = 16
SQL PDB Process Count = 2
SQL Process Count     = 2

[CONTAINER NAMES]

CDB$ROOT
PDB$SEED
EPDB2
EPDB1
PDB Inclusion:[EPDB1] Exclusion:[]

------------------------------------------------------
Phases [0-73]
Container Lists Inclusion:[EPDB1] Exclusion:[]
Serial   Phase #: 0 Files: 1 
    Time: 47s   EPDB1
Serial   Phase #: 1 Files: 5     Time: 86s   EPDB1
Restart  Phase #: 2 Files: 1     Time: 0s    EPDB1
Parallel Phase #: 3 Files: 18    Time: 29s   EPDB1
Restart  Phase #: 4 Files: 1     Time: 0s    EPDB1
Serial   Phase #: 5 Files: 5     Time: 36s   EPDB1
Serial   Phase #: 6 Files: 1     Time: 17s   EPDB1
Serial   Phase #: 7 Files: 4     Time: 14s   EPDB1
Restart  Phase #: 8 Files: 1     Time: 0s    EPDB1
Parallel Phase #: 9 Files: 62    Time: 113s  EPDB1
Restart  Phase #:10 Files: 1     Time: 0s    EPDB1
Serial   Phase #:11 Files: 1     Time: 32s   EPDB1
Restart  Phase #:12 Files: 1     Time: 0s    EPDB1
Parallel Phase #:13 Files: 91    Time: 7s    EPDB1
Restart  Phase #:14 Files: 1     Time: 0s    EPDB1
Parallel Phase #:15 Files: 111   Time: 16s   EPDB1
Restart  Phase #:16 Files: 1     Time: 0s    EPDB1
Serial   Phase #:17 Files: 3     Time: 4s    EPDB1
Restart  Phase #:18 Files: 1     Time: 0s    EPDB1
Parallel Phase #:19 Files: 32    Time: 39s   EPDB1
Restart  Phase #:20 Files: 1     Time: 0s    EPDB1
Serial   Phase #:21 Files: 3     Time: 12s   EPDB1
Restart  Phase #:22 Files: 1     Time: 0s    EPDB1
Parallel Phase #:23 Files: 23    Time: 142s  EPDB1
Restart  Phase #:24 Files: 1     Time: 0s    EPDB1
Parallel Phase #:25 Files: 11    Time: 47s   EPDB1
Restart  Phase #:26 Files: 1     Time: 1s    EPDB1
Serial   Phase #:27 Files: 1     Time: 0s    EPDB1
Restart  Phase #:28 Files: 1     Time: 0s    EPDB1
Serial   Phase #:30 Files: 1     Time: 0s    EPDB1
Serial   Phase #:31 Files: 257   Time: 39s   EPDB1
Serial   Phase #:32 Files: 1     Time: 0s    EPDB1
Restart  Phase #:33 Files: 1     Time: 0s    EPDB1
Serial   Phase #:34 Files: 1     Time: 4s    EPDB1
Restart  Phase #:35 Files: 1     Time: 0s    EPDB1
Restart  Phase #:36 Files: 1     Time: 0s    EPDB1
Serial   Phase #:37 Files: 4     Time: 67s   EPDB1
Restart  Phase #:38 Files: 1     Time: 0s    EPDB1
Parallel Phase #:39 Files: 13    Time: 71s   EPDB1
Restart  Phase #:40 Files: 1     Time: 0s    EPDB1
Parallel Phase #:41 Files: 10    Time: 10s   EPDB1
Restart  Phase #:42 Files: 1     Time: 0s    EPDB1
Serial   Phase #:43 Files: 1     Time: 9s    EPDB1
Restart  Phase #:44 Files: 1     Time: 0s    EPDB1
Serial   Phase #:45 Files: 1     Time: 1s    EPDB1
Serial   Phase #:46 Files: 1     Time: 1s    EPDB1
Restart  Phase #:47 Files: 1     Time: 0s    EPDB1
Serial   Phase #:48 Files: 1     Time: 360s  EPDB1
Restart  Phase #:49 Files: 1     Time: 0s    EPDB1
Serial   Phase #:50 Files: 1     Time: 76s   EPDB1
Restart  Phase #:51 Files: 1     Time: 0s    EPDB1
Serial   Phase #:52 Files: 1     Time: 71s   EPDB1
Restart  Phase #:53 Files: 1     Time: 0s    EPDB1
Serial   Phase #:54 Files: 1     Time: 86s   EPDB1
Restart  Phase #:55 Files: 1     Time: 0s    EPDB1
Serial   Phase #:56 Files: 1     Time: 108s  EPDB1
Restart  Phase #:57 Files: 1     Time: 0s    EPDB1
Serial   Phase #:58 Files: 1     Time: 171s  EPDB1
Restart  Phase #:59 Files: 1     Time: 0s    EPDB1
Serial   Phase #:60 Files: 1     Time: 179s  EPDB1
Restart  Phase #:61 Files: 1     Time: 0s    EPDB1
Serial   Phase #:62 Files: 1     Time: 268s  EPDB1
Restart  Phase #:63 Files: 1     Time: 0s    EPDB1
Serial   Phase #:64 Files: 1     Time: 0s    EPDB1
Serial   Phase #:65 Files: 1 Calling sqlpatch with LD_LIBRARY_PATH=/u01/app/oracle/product/12.1.0.2/db_ee_1/lib; export LD_LIBRARY_PATH;/u01/app/oracle/product/12.1.0.2/db_ee_1/perl/bin/perl -I /u01/app/oracle/product/12.1.0.2/db_ee_1/rdbms/admin -I /u01/app/oracle/product/12.1.0.2/db_ee_1/rdbms/admin/../../sqlpatch /u01/app/oracle/product/12.1.0.2/db_ee_1/rdbms/admin/../../sqlpatch/sqlpatch.pl -verbose -upgrade_mode_only -pdbs EPDB1 > /home/oracle/upgrade/catupgrdepdb1_datapatch_upgrade.log 2> /home/oracle/upgrade/catupgrdepdb1_datapatch_upgrade.err
returned from sqlpatch
    Time: 72s   EPDB1
Serial   Phase #:66 Files: 1     Time: 5s    EPDB1
Serial   Phase #:68 Files: 1     Time: 4s    EPDB1
Serial   Phase #:69 Files: 1 Calling sqlpatch with LD_LIBRARY_PATH=/u01/app/oracle/product/12.1.0.2/db_ee_1/lib; export LD_LIBRARY_PATH;/u01/app/oracle/product/12.1.0.2/db_ee_1/perl/bin/perl -I /u01/app/oracle/product/12.1.0.2/db_ee_1/rdbms/admin -I /u01/app/oracle/product/12.1.0.2/db_ee_1/rdbms/admin/../../sqlpatch /u01/app/oracle/product/12.1.0.2/db_ee_1/rdbms/admin/../../sqlpatch/sqlpatch.pl -verbose -pdbs EPDB1 > /home/oracle/upgrade/catupgrdepdb1_datapatch_normal.log 2> /home/oracle/upgrade/catupgrdepdb1_datapatch_normal.err
returned from sqlpatch
    Time: 49s   EPDB1
Serial   Phase #:70 Files: 1     Time: 18s   EPDB1
Serial   Phase #:71 Files: 1     Time: 28s   EPDB1
Serial   Phase #:72 Files: 1     Time: 4s    EPDB1
Serial   Phase #:73 Files: 1     Time: 0s    EPDB1

Grand Total Time: 2347s EPDB1

LOG FILES: (catupgrdepdb1*.log)

Upgrade Summary Report Located in:
/u01/app/oracle/product/12.1.0.2/db_ee_1/cfgtoollogs/ECDB2/upgrade/upg_summary.log

Total Upgrade Time:          [0d:0h:39m:7s]

     Time: 2351s For PDB(s)

Grand Total Time: 2351s 

LOG FILES: (catupgrd*.log)

Grand Total Upgrade Time:    [0d:0h:39m:11s]

Check the PDB status after the upgrade

SQL> select pdb_name, status, vsn from cdb_pdbs;

PDB_NAME   STATUS        VSN
---------- --------- ----------
EPDB2      NORMAL    202375680
PDB$SEED   NORMAL    202375680
EPDB1      NORMAL    202375680

Now open the PDB and run the post upgrade fixups to complete the migration.

SQL> alter pluggable database EPDB1 open;
Pluggable database altered.
SQL> @/u01/app/oracle/cfgtoollogs/ECDB1/preupgrade/postupgrade_fixups.sql
Post Upgrade Fixup Script Generated on 2014-08-07 16:27:36  Version: 12.1.0.1 Build: 006
Beginning Post-Upgrade Fixups...

PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.

**********************************************************************
                     [Post-Upgrade Recommendations]
**********************************************************************


PL/SQL procedure successfully completed.

                        *****************************************
                        ******** Fixed Object Statistics ********
                        *****************************************

Please create stats on fixed objects two weeks
after the upgrade using the command:
   EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

^^^ MANUAL ACTION SUGGESTED ^^^


PL/SQL procedure successfully completed.


           **************************************************
                ************* Fixup Summary ************

No fixup routines were executed.

           **************************************************

PL/SQL procedure successfully completed.

*************** Post Upgrade Fixup Script Complete ********************

PL/SQL procedure successfully completed.

Summary:

It is not really unplug and plugin for upgrade a PDB. In my VMWare Lab I needed around 1 hours to upgrade one PDB. I am wondering that the dictionary upgrade needs so much time. As for my understanding the PDB dictionary should be pointers into the root.

As always comments are welcome.

Advertisements

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s