In this post, we will see how we can upgrade the Pluggable database of Oracle 12c Release 1 to Oracle 12c Release 2.

Source Version 12.1.0.2.0
Upgrade Version 12.2.0.1.0
Pluggable Database Name PDB

Step 1: Check the version of the pluggable database

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Aug 29 07:08:49 2018

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>

Step 2: Check pdb name using show pdbs command

SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 PDB				  READ WRITE NO

Step 3: Run pre-upgrade script

[oracle@localhost ~]$ /u01/oracle/product/12.1.0/db_1/jdk/bin/java -jar /u01/oracle/product/12.2.0/db_1/rdbms/admin/preupgrade.jar FILE DIR /u01/upgrade
Preupgrade generated files:
    /u01/upgrade/preupgrade.log
    /u01/upgrade/preupgrade_fixups.sql
    /u01/upgrade/postupgrade_fixups.sql
[oracle@localhost ~]$

Step 4: Login to pdb and run the preupgrade_fixup script

[oracle@localhost upgrade]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Aug 29 07:37:22 2018

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> alter session set container=pdb;

Session altered.

SQL> show  con_name

CON_NAME
------------------------------
PDB
SQL> @/u01/upgrade/preupgrade_fixups_PDB.sql
Executing Oracle PRE-Upgrade Fixup Script

Auto-Generated by:       Oracle Preupgrade Script
                         Version: 12.2.0.1.0 Build: 1
Generated on:            2018-08-29 07:33:31

For Source Database:     CDB1
Source Database Version: 12.1.0.2.0
For Upgrade to Version:  12.2.0.1.0

Executing in container:  PDB

                          Fixup
Check Name                Status  Further DBA Action
----------                ------  ------------------
dictionary_stats          Passed  None
apex_upgrade_msg          Failed  Manual fixup recommended.

PL/SQL procedure successfully completed.

SQL>

Note: As I am upgrading pdb using migrating pdb to empty container I need to remove apex from Source pdb .

[oracle@localhost u01]$ cd $ORACLE_HOME/apex
SQL> spool apexremove
SQL> @apxremov_con.sql

PL/SQL procedure successfully completed.

Performing installation in multitenant container database in the background.
The installation progress is spooled into apxremov*_con*.log files.

Please wait...

catcon: ALL catcon-related output will be written to apxremov1_con_catcon_7487.lst
catcon: See apxremov1_con*.log files for output generated by scripts
catcon: See apxremov1_con_*.lst files for spool files, if any
catcon.pl: completed successfully

catcon: ALL catcon-related output will be written to apxremov2_con_catcon_7607.lst
catcon: See apxremov2_con*.log files for output generated by scripts
catcon: See apxremov2_con_*.lst files for spool files, if any
catcon.pl: completed successfully


Installation completed. Log files for each container can be found in:

apxremov*_con*.log

You can quickly scan for ORA errors or compilation errors by using a utility
like grep:

grep ORA- *.log
grep PLS- *.log

Step 3 : Check after removing apex is there any invalid component exists

SQL> select COMP_ID, STATUS from DBA_REGISTRY where COMP_ID='APEX';

no rows selected

SQL> select object_name, status from dba_objects where status='INVALID';

OBJECT_NAME															 STATUS
-------------------------------------------------------------------------------------------------------------------------------- -------
APEX_PKG_APP_INSTALL_LOG													 INVALID
APEX_SPATIAL															 INVALID

Step 4 : Compile them using utlrp.sql

SQL> @?/rdbms/admin/utlrp.sql

Step 5 : Close pdb

SQL> alter pluggable database pdb close immediate;

Pluggable database altered.

Step 6 : Unplug pdb

SQL> alter pluggable database pdb unplug into '/u02/pdb_121.xml';

Pluggable database altered.

Step 7 : Connect to an empty container of 12.2

SQL> CREATE PLUGGABLE DATABASE PDB USING '/u02/pdb_121.xml';

Pluggable database created.

Step 8 : Check the pluggable database

SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 PDB				  MOUNTED

Step 9 : Open pdb in upgrade mode

SQL> alter pluggable database pdb open upgrade;

Pluggable database altered.

Step 10 : Run catupgrd.sql

[oracle@localhost admin]$ $ORACLE_HOME/perl/bin/perl catctl.pl -c 'PDB' catupgrd.sql

Step 11 : Monitor catupgrd.sql

[oracle@localhost admin]$ $ORACLE_HOME/perl/bin/perl catctl.pl -c 'PDB' catupgrd.sql

Argument list for [catctl.pl]
Run in                c = PDB
Do not run in         C = 0
Input Directory       d = 0
Echo OFF              e = 1
Simulate              E = 0
Forced cleanup        F = 0
Log Id                i = 0
Child Process         I = 0
Log Dir               l = 0
Priority List Name    L = 0
Upgrade Mode active   M = 0
SQL Process Count     n = 0
SQL PDB Process Count N = 0
Open Mode Normal      o = 0
Start Phase           p = 0
End Phase             P = 0
Reverse Order         r = 0
AutoUpgrade Resume    R = 0
Script                s = 0
Serial Run            S = 0
RO User Tablespaces   T = 0
Display Phases        y = 0
Debug catcon.pm       z = 0
Debug catctl.pl       Z = 0

catctl.pl VERSION: [12.2.0.1.0]
           STATUS: [production]
            BUILD: [RDBMS_12.2.0.1.0_LINUX.X64_170125]


/u01/oracle/product/12.2.0/db_1/rdbms/admin/orahome = [/u01/oracle/product/12.2.0/db_1]
/u01/oracle/product/12.2.0/db_1/bin/orabasehome = [/u01/oracle/product/12.2.0/db_1]
catctlGetOrabase = [/u01/oracle/product/12.2.0/db_1]

Analyzing file /u01/oracle/product/12.2.0/db_1/rdbms/admin/catupgrd.sql

Log file directory = [/tmp/cfgtoollogs/upgrade20180830001550]

catcon: ALL catcon-related output will be written to [/tmp/cfgtoollogs/upgrade20180830001550/catupgrd_catcon_11148.lst]
catcon: See [/tmp/cfgtoollogs/upgrade20180830001550/catupgrd*.log] files for output generated by scripts
catcon: See [/tmp/cfgtoollogs/upgrade20180830001550/catupgrd_*.lst] files for spool files, if any

Number of Cpus        = 1
Database Name         = cdb12
DataBase Version      = 12.2.0.1.0
catcon: ALL catcon-related output will be written to [/u01/oracle/product/12.2.0/db_1/cfgtoollogs/cdb12/upgrade20180830001552/catupgrd_catcon_11148.lst]
catcon: See [/u01/oracle/product/12.2.0/db_1/cfgtoollogs/cdb12/upgrade20180830001552/catupgrd*.log] files for output generated by scripts
catcon: See [/u01/oracle/product/12.2.0/db_1/cfgtoollogs/cdb12/upgrade20180830001552/catupgrd_*.lst] files for spool files, if any

Log file directory = [/u01/oracle/product/12.2.0/db_1/cfgtoollogs/cdb12/upgrade20180830001552]

PDB Parallel SQL Process Count = [2] is higher or equal to CPU Count = [1]
Concurrent PDB Upgrades defaulting to CPU Count [1]
Parallel SQL Process Count (PDB)      = 2
Parallel SQL Process Count (CDB$ROOT) = 4
Concurrent PDB Upgrades               = 1
Generated PDB Inclusion:[PDB]
CDB$ROOT  Open Mode = [OPEN]

Start processing of PDB
[/u01/oracle/product/12.2.0/db_1/perl/bin/perl catctl.pl -c 'PDB' -I -i pdb -n 2 -l /u01/oracle/product/12.2.0/db_1/cfgtoollogs/cdb12/upgrade20180830001552 catupgrd.sql]

Argument list for [catctl.pl]
Run in                c = PDB
Do not run in         C = 0
Input Directory       d = 0
Echo OFF              e = 1
Simulate              E = 0
Forced cleanup        F = 0
Log Id                i = pdb
Child Process         I = 1
Log Dir               l = /u01/oracle/product/12.2.0/db_1/cfgtoollogs/cdb12/upgrade20180830001552
Priority List Name    L = 0
Upgrade Mode active   M = 0
SQL Process Count     n = 2
SQL PDB Process Count N = 0
Open Mode Normal      o = 0
Start Phase           p = 0
End Phase             P = 0
Reverse Order         r = 0
AutoUpgrade Resume    R = 0
Script                s = 0
Serial Run            S = 0
RO User Tablespaces   T = 0
Display Phases        y = 0
Debug catcon.pm       z = 0
Debug catctl.pl       Z = 0

catctl.pl VERSION: [12.2.0.1.0]
           STATUS: [production]
            BUILD: [RDBMS_12.2.0.1.0_LINUX.X64_170125]


/u01/oracle/product/12.2.0/db_1/rdbms/admin/orahome = [/u01/oracle/product/12.2.0/db_1]
/u01/oracle/product/12.2.0/db_1/bin/orabasehome = [/u01/oracle/product/12.2.0/db_1]
catctlGetOrabase = [/u01/oracle/product/12.2.0/db_1]

Analyzing file /u01/oracle/product/12.2.0/db_1/rdbms/admin/catupgrd.sql

Log file directory = [/u01/oracle/product/12.2.0/db_1/cfgtoollogs/cdb12/upgrade20180830001552]

catcon: ALL catcon-related output will be written to [/u01/oracle/product/12.2.0/db_1/cfgtoollogs/cdb12/upgrade20180830001552/catupgrdpdb_catcon_11285.lst]
catcon: See [/u01/oracle/product/12.2.0/db_1/cfgtoollogs/cdb12/upgrade20180830001552/catupgrdpdb*.log] files for output generated by scripts
catcon: See [/u01/oracle/product/12.2.0/db_1/cfgtoollogs/cdb12/upgrade20180830001552/catupgrdpdb_*.lst] files for spool files, if any

Number of Cpus        = 1
Database Name         = cdb12
DataBase Version      = 12.2.0.1.0
Generated PDB Inclusion:[PDB]
CDB$ROOT  Open Mode = [OPEN]
Components in [PDB]
    Installed [APS CATALOG CATJAVA CATPROC CONTEXT DV JAVAVM OLS ORDIM OWM SDO XDB XML XOQ]
Not Installed [APEX EM MGW ODM RAC WK]

------------------------------------------------------
Phases [0-115]         Start Time:[2018_08_30 00:16:04]
Container Lists Inclusion:[PDB] Exclusion:[NONE]
------------------------------------------------------
***********   Executing Change Scripts   ***********
Serial   Phase #:0    [PDB] Files:1

Step 12 : Open pdb in normal mode

SQL> alter pluggable database pdb open;

Pluggable database altered.

Step 13 : Check pdb state with show pdbs command

SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 PDB				  READ WRITE NO

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us an Invitation or Follow us:

Telegram Channel: https://t.me/helporacle

Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/

Joel Perez’s LinkedIn: Joel Perez’s Profile

LinkedIn Group: Oracle Cloud DBAAS

Facebook Page: OracleHelp

About The Author

Leave a Reply

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