Apply Patch 28828733 – GI Jan 2019 Release Update 12.2.0.1.190115

Here is the GI environment to be patched:

GI HOME:  12.2.0.1
DB HOMES: 12.2.0.1

Patches downloaded :

GI HOME: 12.2.0.1 : GI Jan 2019 Release Update 12.2.0.1.190115
Patch NumberDescriptionApplicable Homes
28822515Database Jan 2019 Release Update 12.2.0.1.190115Only DB Home for non-Oracle RAC setup. Both DB Homes and Grid Home for Oracle RAC setup.
28870605OCW Jan 2019 Release Update 12.2.0.1.190115Both DB Homes and Grid Home
28864846ACFS Jan 2019 Release Update 12.2.0.1.190115Only Grid Home
26839277DBWLM Release Update 12.2.0.1.170913Only Grid Home
28566910Tomcat Release Update 12.2.0.1.0Only Grid Home

1) Check and install the latest OPatch utility , which should be greater than 12.2.0.1.12 on all RAC nodes .

[grid@racnode1 ~]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.2.0.1.18

OPatch succeeded.
[grid@racnode2 ~]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.2.0.1.18

OPatch succeeded.
[grid@racnode2 ~]$

2) Run OPatch Conflict Check.

First run as GI owner grid user:

[grid@racnode1 trace]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /media/sf_Software/12201-190115/28828733/28822515
Oracle Interim Patch Installer version 12.2.0.1.18
Copyright (c) 2020, Oracle Corporation. All rights reserved.

PREREQ session

Oracle Home : /u01/app/12.2.0.1/grid
Central Inventory : /u01/app/oraInventory
from : /u01/app/12.2.0.1/grid/oraInst.loc
OPatch version : 12.2.0.1.18
OUI version : 12.2.0.1.4
Log file location : /u01/app/12.2.0.1/grid/cfgtoollogs/opatch/opatch2020-02-27_21-01-36PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
[grid@racnode1 trace]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /media/sf_Software/12201-190115/28828733/28870605
Oracle Interim Patch Installer version 12.2.0.1.18
Copyright (c) 2020, Oracle Corporation. All rights reserved.

PREREQ session

Oracle Home : /u01/app/12.2.0.1/grid
Central Inventory : /u01/app/oraInventory
from : /u01/app/12.2.0.1/grid/oraInst.loc
OPatch version : 12.2.0.1.18
OUI version : 12.2.0.1.4
Log file location : /u01/app/12.2.0.1/grid/cfgtoollogs/opatch/opatch2020-02-27_21-01-37PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
[grid@racnode1 trace]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /media/sf_Software/12201-190115/28828733/28864846
Oracle Interim Patch Installer version 12.2.0.1.18
Copyright (c) 2020, Oracle Corporation. All rights reserved.

PREREQ session

Oracle Home : /u01/app/12.2.0.1/grid
Central Inventory : /u01/app/oraInventory
from : /u01/app/12.2.0.1/grid/oraInst.loc
OPatch version : 12.2.0.1.18
OUI version : 12.2.0.1.4
Log file location : /u01/app/12.2.0.1/grid/cfgtoollogs/opatch/opatch2020-02-27_21-01-38PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
[grid@racnode1 trace]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /media/sf_Software/12201-190115/28828733/26839277
Oracle Interim Patch Installer version 12.2.0.1.18
Copyright (c) 2020, Oracle Corporation. All rights reserved.

PREREQ session

Oracle Home : /u01/app/12.2.0.1/grid
Central Inventory : /u01/app/oraInventory
from : /u01/app/12.2.0.1/grid/oraInst.loc
OPatch version : 12.2.0.1.18
OUI version : 12.2.0.1.4
Log file location : /u01/app/12.2.0.1/grid/cfgtoollogs/opatch/opatch2020-02-27_21-01-40PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
[grid@racnode1 trace]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /media/sf_Software/12201-190115/28828733/28566910
Oracle Interim Patch Installer version 12.2.0.1.18
Copyright (c) 2020, Oracle Corporation. All rights reserved.

PREREQ session

Oracle Home : /u01/app/12.2.0.1/grid
Central Inventory : /u01/app/oraInventory
from : /u01/app/12.2.0.1/grid/oraInst.loc
OPatch version : 12.2.0.1.18
OUI version : 12.2.0.1.4
Log file location : /u01/app/12.2.0.1/grid/cfgtoollogs/opatch/opatch2020-02-27_21-01-44PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
[grid@racnode1 trace]$

Second run as Database Home owner user oracle:

[oracle@racnode2 dbhome_1]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /media/sf_Software/12201-190115/28828733/28822515
Oracle Interim Patch Installer version 12.2.0.1.18
Copyright (c) 2020, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /u01/app/oracle/product/12.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.2.0/dbhome_1/oraInst.loc
OPatch version    : 12.2.0.1.18
OUI version       : 12.2.0.1.4
Log file location : /u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/opatch/opatch2020-02-27_21-20-54PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
[oracle@racnode2 dbhome_1]$  $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /media/sf_Software/12201-190115/28828733/28870605
Oracle Interim Patch Installer version 12.2.0.1.18
Copyright (c) 2020, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /u01/app/oracle/product/12.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.2.0/dbhome_1/oraInst.loc
OPatch version    : 12.2.0.1.18
OUI version       : 12.2.0.1.4
Log file location : /u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/opatch/opatch2020-02-27_21-21-07PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
[oracle@racnode2 dbhome_1]$

3)Run OPatch SystemSpace Check:

Check if enough free space is available on the ORACLE_HOME filesystem for the patches to be applied as given below:

  • For Grid Infrastructure Home, as home user grid:
    1. Create file /tmp/patch_list_gihome.txt with the following content:
      % cat /tmp/patch_list_gihome.txt
      
      /media/sf_Software/12201-190115/28828733/28822515
      /media/sf_Software/12201-190115/28828733/28870605
      /media/sf_Software/12201-190115/28828733/28864846
      /media/sf_Software/12201-190115/28828733/26839277
      /media/sf_Software/12201-190115/28828733/28566910
    2. Run the opatch command to check if enough free space is available in the Grid Infrastructure Home:
      [grid@racnode1 ~]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
      Oracle Interim Patch Installer version 12.2.0.1.18
      Copyright (c) 2020, Oracle Corporation.  All rights reserved.
      
      PREREQ session
      
      Oracle Home       : /u01/app/12.2.0.1/grid
      Central Inventory : /u01/app/oraInventory
         from           : /u01/app/12.2.0.1/grid/oraInst.loc
      OPatch version    : 12.2.0.1.18
      OUI version       : 12.2.0.1.4
      Log file location : /u01/app/12.2.0.1/grid/cfgtoollogs/opatch/opatch2020-02-27_21-26-51PM_1.log
      
      Invoking prereq "checksystemspace"
      
      Prereq "checkSystemSpace" passed.
      
      OPatch succeeded.
      [grid@racnode1 ~]$

      For Database home, as home user oracle:

      1. Create file /tmp/patch_list_dbhome.txt with the following content:
        $ cat /tmp/patch_list_dbhome.txt
        /media/sf_Software/12201-190115/28828733/28822515
        /media/sf_Software/12201-190115/28828733/28870605
        
      2. Run opatch command to check if enough free space is available in the Database Home:
        [oracle@racnode1 ~]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
        Oracle Interim Patch Installer version 12.2.0.1.18
        Copyright (c) 2020, Oracle Corporation.  All rights reserved.
        
        PREREQ session
        
        Oracle Home       : /u01/app/oracle/product/12.2.0/dbhome_1
        Central Inventory : /u01/app/oraInventory
           from           : /u01/app/oracle/product/12.2.0/dbhome_1/oraInst.loc
        OPatch version    : 12.2.0.1.18
        OUI version       : 12.2.0.1.4
        Log file location : /u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/opatch/opatch2020-02-27_21-37-53PM_1.log
        
        Invoking prereq "checksystemspace"
        
        Prereq "checkSystemSpace" passed.
        
        OPatch succeeded.
        [oracle@racnode1 ~]$

4) Check for conflicts in both the 12.2.0.1 GI home and the 12.2.0.1 DB homes.

  • In case you are applying the patch, run this command:
    [root@racnode1 ~]# /u01/app/12.2.0.1/grid/OPatch/opatchauto apply /media/sf_Software/12201-190115/28828733 -analyze
    
    OPatchauto session is initiated at Thu Feb 27 21:41:27 2020
    
    System initialization log file is /u01/app/12.2.0.1/grid/cfgtoollogs/opatchautodb/systemconfig2020-02-27_09-41-30PM.log.
    
    Session log file is /u01/app/12.2.0.1/grid/cfgtoollogs/opatchauto/opatchauto2020-02-27_09-42-17PM.log
    The id for this session is GKR6
    
    Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0.1/grid
    
    Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/12.2.0/dbhome_1
    Patch applicability verified successfully on home /u01/app/oracle/product/12.2.0/dbhome_1
    
    Patch applicability verified successfully on home /u01/app/12.2.0.1/grid
    
    
    Verifying SQL patch applicability on home /u01/app/oracle/product/12.2.0/dbhome_1
    
    Following step failed during analysis:
     /bin/sh -c 'cd /u01/app/oracle/product/12.2.0/dbhome_1; ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 ORACLE_SID=RACTESTB1 /u01/app/oracle/product/12.2.0/dbhome_1/OPatch/datapatch -prereq -verbose'
    
    SQL patch applicability verified successfully on home /u01/app/oracle/product/12.2.0/dbhome_1
    
    OPatchAuto successful.
    
    --------------------------------Summary--------------------------------
    
    Analysis for applying patches has completed successfully:
    
    Host:racnode1
    RAC Home:/u01/app/oracle/product/12.2.0/dbhome_1
    Version:12.2.0.1.0
    
    
    ==Following patches were SKIPPED:
    
    Patch: /media/sf_Software/12201-190115/28828733/28864846
    Reason: This patch is not applicable to this specified target type - "rac_database"
    
    Patch: /media/sf_Software/12201-190115/28828733/26839277
    Reason: This patch is not applicable to this specified target type - "rac_database"
    
    Patch: /media/sf_Software/12201-190115/28828733/28566910
    Reason: This patch is not applicable to this specified target type - "rac_database"
    
    
    ==Following patches were SUCCESSFULLY analyzed to be applied:
    
    Patch: /media/sf_Software/12201-190115/28828733/28870605
    Log: /u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2020-02-27_21-42-30PM_1.log
    
    Patch: /media/sf_Software/12201-190115/28828733/28822515
    Log: /u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2020-02-27_21-42-30PM_1.log
    
    
    Host:racnode1
    CRS Home:/u01/app/12.2.0.1/grid
    Version:12.2.0.1.0
    
    
    ==Following patches were SUCCESSFULLY analyzed to be applied:
    
    Patch: /media/sf_Software/12201-190115/28828733/28870605
    Log: /u01/app/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2020-02-27_21-42-30PM_1.log
    
    Patch: /media/sf_Software/12201-190115/28828733/28864846
    Log: /u01/app/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2020-02-27_21-42-30PM_1.log
    
    Patch: /media/sf_Software/12201-190115/28828733/26839277
    Log: /u01/app/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2020-02-27_21-42-30PM_1.log
    
    Patch: /media/sf_Software/12201-190115/28828733/28566910
    Log: /u01/app/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2020-02-27_21-42-30PM_1.log
    
    Patch: /media/sf_Software/12201-190115/28828733/28822515
    Log: /u01/app/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2020-02-27_21-42-30PM_1.log
    
    Following homes are skipped during patching as patches are not applicable:
    
    /u01/app/oracle/product/12.1.0/dbhome_1
    
    OPatchauto session completed at Thu Feb 27 21:42:41 2020
    Time taken to complete the session 1 minute, 14 seconds
    [root@racnode1 ~]#
  • In case you are rolling back the patch, run this command:
    #GRID_HOME/OPatch/opatchauto rollback <UNZIPPED_PATCH_LOCATION>/28828733 -analyze

5) Patch both 12.2.0.2 GI and 12.2.0.1 DB home by running “opatchauto” as root user.

[root@racnode1 ~]# /u01/app/12.2.0.1/grid/OPatch/opatchauto  \
                apply /media/sf_Software/12201-190115/28828733

6) Please repeat step 1 to 5 on node 2.

opatchauto_log

7)Run “datapatch” or post patch SQL as per instructions, if ‘opatchauto’ is not used.

Check the log :

[oracle@racnode2 22636216]$ pwd
/u01/app/oracle/cfgtoollogs/sqlpatch/28822515/22636216
[oracle@racnode2 22636216]$ ls -ltr
total 4772
-rw-r--r-- 1 oracle oinstall 520670 Feb 27 22:42 28822515_apply_RACTESTB_CDBROOT_2020Feb27_22_40_48.log
-rw-r--r-- 1 oracle oinstall 4358895 Feb 27 22:43 28822515_apply_RACTESTB_PDBSEED_2020Feb27_22_42_13.log
[oracle@racnode2 22636216]$

8) Check the patches applied.

a) Run ‘opatch lsinventory’ against both GI and DB homes.

As GI Home owner grid user:

[grid@racnode1]$ opatch lsinventory

As DB Home owner oracle user:

[oracle@racnode1]$ opatch lsinventory

b) Query database .

SQL> select PATCH_ID, VERSION, ACTION, STATUS, DESCRIPTION 
     from dba_registry_sqlpatch;

PATCH_ID   VERSION  ACTION  STATUS DESCRIPTION
---------- -------- ------ ------- -------------------------------------
28822515   12.2.0.1 APPLY  SUCCESS DATABASE JAN 2019 RELEASE UPDATE 12.2.0.1.190115

Apply 12.1.0.2.190716 PSU on GI RAC and OJVM

1)Download GI PSU 12.1.0.2.190716 Patch 29698592, and Oracle  JavaVM Component Database PSU 12.1.0.2.190716 Patch 29774383.

2) Download and install latest p6880880_121010_Linux-x86-64.zip for both GI_HOME and RDMS_HOME.

3) Set up PATH

# export PATH=$PATH:/u01/app/12.1.0/grid/OPatch

# opatch version
OPatch Version: 12.2.0.1.17

OPatch succeeded.

4) Apply GI and DB PSU on first node, then do the same on second node.

As root user, execute the following command on each node of the cluster:

# /u01/app/12.1.0/grid/OPatch/opatchauto apply /tmp/29698592

OPatchauto session is initiated at Sun Jul 28 22:39:56 2019

System initialization log file is /u01/app/12.1.0/grid/cfgtoollogs/opatchautodb/systemconfig2019-07-28_10-49-47PM.log.

Session log file is /u01/app/12.1.0/grid/cfgtoollogs/opatchauto/opatchauto2019-07-28_10-51-20PM.log
The id for this session is B1YJ

Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.1.0/grid

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/12.1.0/dbhome_1
Patch applicability verified successfully on home /u01/app/oracle/product/12.1.0/dbhome_1

Patch applicability verified successfully on home /u01/app/12.1.0/grid
Verifying SQL patch applicability on home /u01/app/oracle/product/12.1.0/dbhome_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/12.1.0/dbhome_1
Preparing to bring down database service on home /u01/app/oracle/product/12.1.0/dbhome_1
Successfully prepared home /u01/app/oracle/product/12.1.0/dbhome_1 to bring down database service
Bringing down CRS service on home /u01/app/12.1.0/grid
Prepatch operation log file location: /u01/app/12.1.0/grid/cfgtoollogs/crsconfig/crspatch_racnode1_2019-07-28_11-31-15PM.log
CRS service brought down successfully on home /u01/app/12.1.0/grid
Performing prepatch operation on home /u01/app/oracle/product/12.1.0/dbhome_1
Perpatch operation completed successfully on home /u01/app/oracle/product/12.1.0/dbhome_1
Start applying binary patch on home /u01/app/oracle/product/12.1.0/dbhome_1
Binary patch applied successfully on home /u01/app/oracle/product/12.1.0/dbhome_1
Performing postpatch operation on home /u01/app/oracle/product/12.1.0/dbhome_1
Postpatch operation completed successfully on home /u01/app/oracle/product/12.1.0/dbhome_1
Start applying binary patch on home /u01/app/12.1.0/grid
Binary patch applied successfully on home /u01/app/12.1.0/grid
Starting CRS service on home /u01/app/12.1.0/grid
Postpatch operation log file location: /u01/app/12.1.0/grid/cfgtoollogs/crsconfig/crspatch_racnode1_2019-07-29_01-30-59AM.log
CRS service started successfully on home /u01/app/12.1.0/grid
Preparing home /u01/app/oracle/product/12.1.0/dbhome_1 after database service restarted
No step execution required.........
Trying to apply SQL patch on home /u01/app/oracle/product/12.1.0/dbhome_1
SQL patch applied successfully on home /u01/app/oracle/product/12.1.0/dbhome_1

OPatchAuto successful.
--------------------------------Summary--------------------------------

Patching is completed successfully. Please find the summary as follows:

Host:racnode1
RAC Home:/u01/app/oracle/product/12.1.0/dbhome_1
Version:12.1.0.2.0
Summary:

==Following patches were SKIPPED:

Patch: /tmp/29698592/26983807
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /tmp/29698592/29423125
Reason: This patch is not applicable to this specified target type - "rac_database"
==Following patches were SUCCESSFULLY applied:

Patch: /tmp/29698592/29494060
Log: /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2019-07-28_23-34-47PM_1.log

Patch: /tmp/29698592/29509318
Log: /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2019-07-28_23-34-47PM_1.log
Host:racnode1
CRS Home:/u01/app/12.1.0/grid
Version:12.1.0.2.0
Summary:

==Following patches were SUCCESSFULLY applied:

Patch: /tmp/29698592/26983807
Log: /u01/app/12.1.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2019-07-29_00-16-53AM_1.log

Patch: /tmp/29698592/29423125
Log: /u01/app/12.1.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2019-07-29_00-16-53AM_1.log

Patch: /tmp/29698592/29494060
Log: /u01/app/12.1.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2019-07-29_00-16-53AM_1.log

Patch: /tmp/29698592/29509318
Log: /u01/app/12.1.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2019-07-29_00-16-53AM_1.log

OPatchauto session completed at Mon Jul 29 02:12:00 2019
Time taken to complete the session 212 minutes, 4 seconds
[root@racnode1 ~]#

From the log, we can see GI management database was patched as well.

...
..
.
2019-07-29 01:53:43: Mgmtdb is running on node: racnode1; local node: racnode1
2019-07-29 01:53:43: Mgmtdb is running on the local node
2019-07-29 01:53:43: Starting to patch Mgmt DB ...
2019-07-29 01:53:43: Invoking "/u01/app/12.1.0/grid/sqlpatch/sqlpatch -db -MGMTDB"
2019-07-29 01:53:43: Running as user grid: /u01/app/12.1.0/grid/sqlpatch/sqlpatch -db -MGMTDB
2019-07-29 01:53:43: Invoking "/u01/app/12.1.0/grid/sqlpatch/sqlpatch -db -MGMTDB" as user "grid"
2019-07-29 01:53:43: Executing /bin/su grid -c "/u01/app/12.1.0/grid/sqlpatch/sqlpatch -db -MGMTDB"
2019-07-29 01:53:43: Executing cmd: /bin/su grid -c "/u01/app/12.1.0/grid/sqlpatch/sqlpatch -db -MGMTDB"

5) Apply Patch 29774383 – Oracle JavaVM Component 12.1.0.2.190716 Database PSU.

[oracle@racnode1 patches]$ cd 29774383
[oracle@racnode1 29774383]$
[oracle@racnode1 29774383]$opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2019, Oracle Corporation. All rights reserved.

PREREQ session

Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version : 12.2.0.1.17
OUI version : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2019-07-31_20-53-44PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

[oracle@racnode1 29774383]$ opatch apply
-- on node 2

[oracle@racnode2 29774383]$ export PATH=$PATH:$ORACLE_HOME/OPatch
[oracle@racnode2 29774383]$ opatch apply

Loading Modified SQL Files Into the Database

[oracle@racnode2 29774383]$ sqlplus /nolog

SQL>  CONNECT / AS SYSDBA
Connected to an idle instance.

SQL> STARTUP
ORACLE instance started.
Database mounted.
Database opened.

alter system set cluster_database=false scope=spfile;
System altered.

[oracle@racnode2 29774383]$ srvctl stop database -d RACTEST
[oracle@racnode2 29774383]$ sqlplus /nolog

SQL> CONNECT / AS SYSDBA
Connected to an idle instance.

SQL> STARTUP UPGRADE
ORACLE instance started.
Database mounted.
Database opened.

SQL> alter pluggable database all open upgrade;

Pluggable database altered.
[oracle@racnode2 29774383]$ cd $ORACLE_HOME/OPatch
[oracle@racnode2 OPatch]$ ./datapatch -verbose
SQL Patching tool version 12.1.0.2.0 Production on Wed Jul 31 21:21:07 2019
Copyright (c) 2012, 2016, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/
                 sqlpatch_25124_2019_07_31_21_21_07/sqlpatch_invocation.log

Connecting to database...OK
Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
    Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of SQL patches:
Patch 29774383 (Database PSU 12.1.0.2.190716, Oracle JavaVM Component (JUL2019)):
  Installed in the binary registry only
Bundle series PSU:
  ID 190716 in the binary registry and ID 190716 in PDB CDB$ROOT, ID 190716 in PDB PDB$SEED, ID 190716 in PDB PDB_A

Adding patches to installation queue and performing prereq checks...
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED PDB_A
    Nothing to roll back
    The following patches will be applied:
      29774383 (Database PSU 12.1.0.2.190716, Oracle JavaVM Component (JUL2019))

Installing patches...
Patch installation complete.  Total patches installed: 3

Validating logfiles...
Patch 29774383 apply (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_RACTEST_CDBROOT_2019Jul31_21_22_21.log (no errors)
Patch 29774383 apply (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_RACTEST_PDBSEED_2019Jul31_21_25_13.log (no errors)
Patch 29774383 apply (pdb PDB_A): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_RACTEST_PDB_A_2019Jul31_21_25_13.log (no errors)
SQL Patching tool complete on Wed Jul 31 21:26:52 2019
[oracle@racnode2 OPatch]$ sqlplus /nolog

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jul 31 21:29:55 2019

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

SQL> Connect / as sysdba
Connected.
SQL> alter system set cluster_database=true scope=spfile;

System altered.

SQL> SHUTDOWN
Database closed.
Database dismounted.
ORACLE instance shut down.

[oracle@racnode2 OPatch]$ srvctl start  database -d RACTEST

[oracle@racnode2 OPatch]$ sqlplus /as sysdba

SQL> @ $ORACLE_HOME/rdbms/admin/utlrp.sql

Finally check applied patches on both nodes and databases.

$opatch lsinventory
SQL> show con_name

CON_NAME
---------------
CDB$ROOT

SQL> select PATCH_ID, STATUS, VERSION, DESCRIPTION  
       from dba_registry_sqlpatch
  PATCH_ID STATUS     VERSION   DESCRIPTION
---------- ---------- --------- ------------------------------------------
  29494060 SUCCESS    12.1.0.2  DATABASE PATCH SET UPDATE 12.1.0.2.190716
  29774383 SUCCESS    12.1.0.2  Database PSU 12.1.0.2.190716, 
                                Oracle JavaVM Component (JUL2019)
SQL> alter session set container=PDB_A;

Session altered.

SQL> show con_name;

CON_NAME
------------------------------
PDB_A

SQL> select PATCH_ID, STATUS, VERSION, DESCRIPTION 
      from dba_registry_sqlpatch

PATCH_ID  STATUS  VERSION  DESCRIPTION
--------- ------- -------- --------------------------------------
29494060  SUCCESS 12.1.0.2 DATABASE PATCH SET UPDATE 12.1.0.2.190716
29774383  SUCCESS 12.1.0.2 Database PSU 12.1.0.2.190716, 
                           Oracle JavaVM Component (JUL2019)
SQL> show parameter instance_name

NAME           TYPE         VALUE
-------------- ----------- ------------------------
instance_name   string     -MGMTDB

SQL>  select PATCH_ID, STATUS, VERSION, DESCRIPTION  
        from dba_registry_sqlpatch;

  PATCH_ID STATUS  VERSION    DESCRIPTION
---------- ------- ---------- ------------------------------------------
  29494060 SUCCESS 12.1.0.2    DATABASE PATCH SET UPDATE 12.1.0.2.190716

Is MGMTDB Patched While Applying GI PSU/RU/RUR ?

MGMTDB will be patched as well at the same time when GI is upgraded or patched ( PSU, RU/RUR, etc).

Yes, while applying PSU patch onto GI, we can see GIMR database “-MGMTDB” is patched as well. It can be confirmed from logs.

a) Logs from “opatchauto apply” shows MGMTDB is patched while applying GI PSU:

System initialization log file is /u01/app/12.1.0.2/grid/cfgtoollogs/opatchautodb/systemconfig2016-09-19_12-46-41PM.log.

Session log file is /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/opatchauto2016-09-19_12-46-55PM.log
The id for this session is 2G1F
[init:init] Executing OPatchAutoBinaryAction action on home /u01/app/12.1.0.2/grid

Executing OPatch prereq operations to verify patch applicability on CRS Home........

[init:init] OPatchAutoBinaryAction action completed on home /u01/app/12.1.0.2/grid successfully
[init:init] Executing GIRACPrereqAction action on home /u01/app/12.1.0.2/grid

Executing prereq operations before applying on CRS Home........

[init:init] GIRACPrereqAction action completed on home /u01/app/12.1.0.2/grid successfully
[shutdown:shutdown] Executing GIShutDownAction action on home /u01/app/12.1.0.2/grid

Performing prepatch operations on CRS Home........

Prepatch operation log file location: /u01/app/12.1.0.2/grid/cfgtoollogs/crsconfig/crspatch_racnode2_2016-09-19_12-47-24AM.log

[shutdown:shutdown] GIShutDownAction action completed on home /u01/app/12.1.0.2/grid successfully
[offline:binary-patching] Executing OPatchAutoBinaryAction action on home /u01/app/12.1.0.2/grid

Start applying binary patches on CRS Home........

[offline:binary-patching] OPatchAutoBinaryAction action completed on home /u01/app/12.1.0.2/grid successfully
[startup:startup] Executing GIStartupAction action on home /u01/app/12.1.0.2/grid

Performing postpatch operations on CRS Home........

Postpatch operation log file location: /u01/app/12.1.0.2/grid/cfgtoollogs/crsconfig/crspatch_racnode2_2016-09-19_12-50-36AM.log

[startup:startup] GIStartupAction action completed on home /u01/app/12.1.0.2/grid successfully
[finalize:finalize] Executing OracleHomeLSInventoryGrepAction action on home /u01/app/12.1.0.2/grid

Verifying patches applied on CRS Home.

[finalize:finalize] OracleHomeLSInventoryGrepAction action completed on home /u01/app/12.1.0.2/grid successfully
OPatchAuto successful.

--------------------------------Summary--------------------------------

Patching is completed successfully. Please find the summary as follows:

Host:racnode2
CRS Home:/u01/app/12.1.0.2/grid
Summary:

==Following patches were SKIPPED:

Patch: /u01/app/software/23615308/23177536
Reason: This patch is not applicable to this specified target type - "cluster"


==Following patches were SUCCESSFULLY applied:

Patch: /u01/app/software/23615308/21436941
Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/opatch/opatch2016-09-19_12-47-55PM_1.log

Patch: /u01/app/software/23615308/23054246
Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/opatch/opatch2016-09-19_12-47-55PM_1.log

Patch: /u01/app/software/23615308/23054327
Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/opatch/opatch2016-09-19_12-47-55PM_1.log

Patch: /u01/app/software/23615308/23054341
Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/opatch/opatch2016-09-19_12-47-55PM_1.log

b) Check Postpatch operation log file /u01/app/12.1.0.2/grid/cfgtoollogs/crsconfig/crspatch_racnode2_2016-09-19_12-50-36AM.log

$ tail -120 /u01/app/12.1.0.2/grid/cfgtoollogs/crsconfig/crspatch_racnode2_2016-09-19_12-50-36AM.log
...

....


2016-09-19 12:52:30: Executing cmd: /u01/app/12.1.0.2/grid/bin/srvctl config mgmtdb
2016-09-19 12:52:31: Command output:
> Database unique name: _mgmtdb
> Database name:
> Oracle home: <CRS home>
> Oracle user: grid
> Spfile: +OCR_VOTE/_MGMTDB/PARAMETERFILE/spfile.268.922884353
> Password file:
> Domain:
> Start options: open
> Stop options: immediate
> Database role: PRIMARY
> Management policy: AUTOMATIC
> Type: Management
> PDB name: racnode-cluster
> PDB service: racnode-cluster
> Cluster name: racnode-cluster
> Database instance: -MGMTDB
>End Command output
2016-09-19 12:52:31: isMgmtdbConfigured: 1
2016-09-19 12:52:31: setting ORAASM_UPGRADE to 1
2016-09-19 12:52:31: Executing cmd: /u01/app/12.1.0.2/grid/bin/crsctl query crs softwarepatch racnode2
2016-09-19 12:52:31: Command output:
> Oracle Clusterware patch level on node racnode2 is [3696455212].
>End Command output
2016-09-19 12:52:31: Oracle Clusterware patch level on node 'racnode2' is [3696455212]
2016-09-19 12:52:31: setting ORAASM_UPGRADE to 1
2016-09-19 12:52:31: Executing cmd: /u01/app/12.1.0.2/grid/bin/crsctl query crs softwarepatch racnode1
2016-09-19 12:52:31: Command output:
> Oracle Clusterware patch level on node racnode1 is [3696455212].
>End Command output
2016-09-19 12:52:31: Oracle Clusterware patch level on node 'racnode1' is [3696455212]
2016-09-19 12:52:31: The local node has the same software patch level [3696455212] as remote node 'racnode1'
2016-09-19 12:52:31: Executing cmd: /u01/app/12.1.0.2/grid/bin/crsctl query crs releasepatch
2016-09-19 12:52:31: Command output:
> Oracle Clusterware release patch level is [3696455212] and the complete list of patches [19769480 20299023 20831110 21359755 21436941 21948354 22291127 23054246 23054327 23054341 ] have been applied on the local node.
>End Command output
2016-09-19 12:52:31: Oracle Clusterware release patch level is [3696455212]
2016-09-19 12:52:31: setting ORAASM_UPGRADE to 1
2016-09-19 12:52:31: Executing cmd: /u01/app/12.1.0.2/grid/bin/crsctl query crs activeversion -f
2016-09-19 12:52:31: Command output:
> Oracle Clusterware active version on the cluster is [12.1.0.2.0]. The cluster upgrade state is [NORMAL]. The cluster active patch level is [3696455212].
>End Command output
2016-09-19 12:52:31: Oracle Clusterware active patch level is [3696455212]
2016-09-19 12:52:31: The Clusterware active patch level [3696455212] has been updated to [3696455212].
2016-09-19 12:52:31: Postpatch: isLastNode is 1
2016-09-19 12:52:31: Last node: enable Mgmt DB globally
2016-09-19 12:52:31: Invoking "/u01/app/12.1.0.2/grid/bin/srvctl enable mgmtdb"
2016-09-19 12:52:31: trace file=/u01/app/12.1.0.2/grid/cfgtoollogs/crsconfig/srvmcfg1.log
2016-09-19 12:52:31: Running as user grid: /u01/app/12.1.0.2/grid/bin/srvctl enable mgmtdb
2016-09-19 12:52:31: Invoking "/u01/app/12.1.0.2/grid/bin/srvctl enable mgmtdb" as user "grid"
2016-09-19 12:52:31: Executing /bin/su grid -c "/u01/app/12.1.0.2/grid/bin/srvctl enable mgmtdb"
2016-09-19 12:52:31: Executing cmd: /bin/su grid -c "/u01/app/12.1.0.2/grid/bin/srvctl enable mgmtdb"
2016-09-19 12:52:32: Modifying 10.2 resources
2016-09-19 12:52:32: Invoking "/u01/app/12.1.0.2/grid/bin/srvctl upgrade model -pretb"
2016-09-19 12:52:32: trace file=/u01/app/12.1.0.2/grid/cfgtoollogs/crsconfig/srvmcfg2.log
2016-09-19 12:52:32: Executing /u01/app/12.1.0.2/grid/bin/srvctl upgrade model -pretb
2016-09-19 12:52:32: Executing cmd: /u01/app/12.1.0.2/grid/bin/srvctl upgrade model -pretb
2016-09-19 12:52:32: 'srvctl upgrade model -pretb' ... success
2016-09-19 12:52:32: Executing cmd: /u01/app/12.1.0.2/grid/bin/srvctl status mgmtdb -S 1
2016-09-19 12:52:32: Command output:
> #@=result[0]: dbunique_name={_mgmtdb} inst_name={-MGMTDB} node_name={racnode2} up={true} state_details={Open} internal_state={STABLE}
>End Command output
2016-09-19 12:52:32: Mgmtdb is running on node: racnode2; local node: racnode2
2016-09-19 12:52:32: Mgmtdb is running on the local node
2016-09-19 12:52:32: Starting to patch Mgmt DB ...
2016-09-19 12:52:32: Invoking "/u01/app/12.1.0.2/grid/sqlpatch/sqlpatch -db -MGMTDB"
2016-09-19 12:52:32: Running as user grid: /u01/app/12.1.0.2/grid/sqlpatch/sqlpatch -db -MGMTDB
2016-09-19 12:52:32: Invoking "/u01/app/12.1.0.2/grid/sqlpatch/sqlpatch -db -MGMTDB" as user "grid"
2016-09-19 12:52:32: Executing /bin/su grid -c "/u01/app/12.1.0.2/grid/sqlpatch/sqlpatch -db -MGMTDB"
2016-09-19 12:52:32: Executing cmd: /bin/su grid -c "/u01/app/12.1.0.2/grid/sqlpatch/sqlpatch -db -MGMTDB"
2016-09-19 12:53:39: Command output:
> SQL Patching tool version 12.1.0.2.0 on Mon Sep 19 12:52:32 2016
> Copyright (c) 2016, Oracle. All rights reserved.
>
> Connecting to database...OK
> Note: Datapatch will only apply or rollback SQL fixes for PDBs
> that are in an open state, no patches will be applied to closed PDBs.
> Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
> (Doc ID 1585822.1)
> Determining current state...done
> Adding patches to installation queue and performing prereq checks...done
> Installation queue:
> For the following PDBs: CDB$ROOT PDB$SEED RACNODE-CLUSTER
> Nothing to roll back
> The following patches will be applied:
> 23054246 (Database Patch Set Update : 12.1.0.2.160719 (23054246))
>
> Installing patches...
> Patch installation complete. Total patches installed: 3
>
> Validating logfiles...done
> SQL Patching tool complete on Mon Sep 19 12:53:39 2016
>End Command output
2016-09-19 12:53:39: Successfully patched Mgmt DB
2016-09-19 12:53:39: Invoking "/u01/app/12.1.0.2/grid/bin/cluutil -ckpt -oraclebase /u01/app/grid -writeckpt -name ROOTCRS_POSTPATCH -state SUCCESS"
2016-09-19 12:53:39: trace file=/u01/app/grid/crsdata/racnode2/crsconfig/cluutil7.log
2016-09-19 12:53:39: Running as user grid: /u01/app/12.1.0.2/grid/bin/cluutil -ckpt -oraclebase /u01/app/grid -writeckpt -name ROOTCRS_POSTPATCH -state SUCCESS
2016-09-19 12:53:39: s_run_as_user2: Running /bin/su grid -c ' echo CLSRSC_START; /u01/app/12.1.0.2/grid/bin/cluutil -ckpt -oraclebase /u01/app/grid -writeckpt -name ROOTCRS_POSTPATCH -state SUCCESS '
2016-09-19 12:53:39: Removing file /tmp/filei2kicY
2016-09-19 12:53:39: Successfully removed file: /tmp/filei2kicY
2016-09-19 12:53:39: pipe exit code: 0
2016-09-19 12:53:39: /bin/su successfully executed

2016-09-19 12:53:39: Succeeded in writing the checkpoint:'ROOTCRS_POSTPATCH' with status:SUCCESS
[+ASM2] grid@racnode2:~$

c) Querying PDB shows MGMTDB has been patched as well.

-- check CDB$ROOT

SQL> set pagesize 120
SQL> set linesize 180
SQL> select * from dba_registry_sqlpatch;

PATCH_ID PATCH_UID VERSION FLAGS ACTION STATUS ACTION_TIME
---------- ---------- -------------------- ---------- --------------- --------------- ---------------------------------------------------------------------------
DESCRIPTION BUNDLE_SERIES BUNDLE_ID
---------------------------------------------------------------------------------------------------- ------------------------------ ----------
BUNDLE_DATA
--------------------------------------------------------------------------------
LOGFILE
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

23054246 20213895 12.1.0.2 NB APPLY SUCCESS 19-SEP-16 12.53.38.034518 PM
Database Patch Set Update : 12.1.0.2.160719 (23054246) PSU 160719
<bundledata version="12.1.0.2.1" series="Patch Set Update">
 <bundle id="1" des
/u01/app/grid/cfgtoollogs/sqlpatch/23054246/20213895/23054246_apply__MGMTDB_CDBROOT_2016Sep19_12_53_18.log



-- check PDB RACNODE-CLUSTER

SQL> alter session set container=racnode-cluster;

SQL> select * from dba_registry_sqlpatch;

PATCH_ID PATCH_UID VERSION FLAGS ACTION STATUS ACTION_TIME
---------- ---------- -------------------- ---------- --------------- --------------- ---------------------------------------------------------------------------
DESCRIPTION BUNDLE_SERIES BUNDLE_ID
---------------------------------------------------------------------------------------------------- ------------------------------ ----------
BUNDLE_DATA
--------------------------------------------------------------------------------
LOGFILE
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
23054246 20213895 12.1.0.2 NB APPLY SUCCESS 19-SEP-16 12.53.38.457190 PM
Database Patch Set Update : 12.1.0.2.160719 (23054246) PSU 160719
<bundledata version="12.1.0.2.1" series="Patch Set Update">
 <bundle id="1" des
/u01/app/grid/cfgtoollogs/sqlpatch/23054246/20213895/23054246_apply__MGMTDB_RACNODE-CLUSTER_2016Sep19_12_53_32.log

Apply Database Patch Set Update 12.1.0.2.2 (Includes CPUJan2015) and Oracle JavaVM Component 12.1.0.2.2 Database PSU (Jan2015) onto CDB Database

Oracle suggests to apply the latest PSU as soon as possible.

1) Download and put in place opatch 12.1.0.1.6 as README required.

2)Download patch “p20132434_121020_Linux-x86-64.zip” which includes both database and JVM 12.1.0.2.2 PSU.

3)unzip p20132434_121020_Linux-x86-64.zip.

4) List files.

[oracle@racnode1 20132434]$ ls -ltr
drwxrwx---. 1 root vboxsf 0 Jan 21 01:09 19769480
-rwxrwx---. 1 root vboxsf 25 Jan 21 01:09 README.txt
drwxrwx---. 1 root vboxsf 0 Jan 21 01:09 19877336
-rwxrwx---. 1 root vboxsf 17979 Jan 21 01:18 README.htm

5) Pre-check.

$cd 19769480
$opatch prereq CheckConflictAgainstOHWithDetail -ph ./

 Oracle Interim Patch Installer version 12.1.0.1.6
 Copyright (c) 2015, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1
Central Inventory : /u01/app/oraInventory
 from : /u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version : 12.1.0.1.6
OUI version : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2015-03-16_21-05-16PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.

6) Opatch apply.

[oracle@racnote1 19769480]$ opatch apply
Oracle Interim Patch Installer version 12.1.0.1.6
Copyright (c) 2015, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1
Central Inventory : /u01/app/oraInventory
 from : /u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version : 12.1.0.1.6
OUI version : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0/dbhome_1/cfgtollogs/opatch/19769480_Mar_16_2015_21_09_50/apply2015-03-16_21-09-50PM_1.log
Applying interim patch '19769480' to OH '/u01/app/oracle/product/12.1.0/dbhome_1'
Verifying environment and performing prerequisite checks...
All checks passed.
Provide your email address to be informed of security issues, insall and initiate Oracle Configuration Manager. Easier for you if you use your My Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:
You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]: Y
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/12.1.0/dbhome_1')
Is the local system ready for patching? [y|n]y
User Responded with: Y
Backing up files...
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.xdk, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms.util, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.xdk.parser.java, 12.1.0.2.0...
Patching component oracle.oraolap, 12.1.0.2.0...
Patching component oracle.xdk.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Verifying the update...
Patch 19769480 successfully applied
Log file location: /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/19769480_Mar_16_2015_21_09_50/apply2015-03-16_21-09-50PM_1.log

OPatch succeeded.

7) load modified SQL files into the database.

$sqlplus /nolog
SQL>connect / as sysdba
SQL> startup
$cd $ORACLE_HOME/OPatch
SQL> quit
SQL> alter pluggable database all open;

SQL> SELECT NAME,OPEN_MODE FROM V$PDBS;

NAME        OPEN_MODE
----------- ----------
PDB$SEED    READ ONLY
PDB2        READ WRITE
PDB2_2      READ WRITE
PDB_ORCL2   READ WRITE
PDB1_1      READ WRITE
PDB_SAMLES  READ WRITE

6 rows selected.

[oracle@racnote1 OPatch]$ ./datapatch -verbose
SQL Patching tool version 12.2.0.0.0 on Mon Mar 16 22:01:39 2015
Copyright (c) 2014, Oracle. All rights reserved.

Connecting to database...OK
Note: Datapatch will only apply or rollback SQL fixes for PDBs
 that are in an open state, no patches will be applied to closed PDBs.
 Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
 (Doc ID 1585822.1)
catcon: ALL catcon-related output will be written to /tmp/sqlpatch_catcon__catcon_8643.lst
catcon: See /tmp/sqlpatch_catcon_*.log files for output generated by scripts
catcon: See /tmp/sqlpatch_catcon__*.lst files for spool files, if any
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of SQL patches:
Bundle series PSU:
 ID 2 in the binary registry and not installed in any PDB

Adding patches to installation queue and performing prereq checks...
Installation queue:
 For the following PDBs: CDB$ROOT PDB$SEED PDB2 PDB2_2 PDB_ORCL2 PDB1_1 PDB_SAMLES
 Nothing to roll back
 The following patches will be applied:
 19769480 (Database Patch Set Update : 12.1.0.2.2 (19769480))

Installing patches...
Patch installation complete. Total patches installed: 7

Validating logfiles...
Patch 19769480 apply (pdb CDB$ROOT): SUCCESS
 logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/19769480/18350083/19769480_apply_CDB2_CDBROOT_2015Mar16_22_02_28.log (no errors)
Patch 19769480 apply (pdb PDB$SEED): SUCCESS
 logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/19769480/18350083/19769480_apply_CDB2_PDBSEED_2015Mar16_22_02_38.log (no errors)
Patch 19769480 apply (pdb PDB2): SUCCESS
 logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/19769480/18350083/19769480_apply_CDB2_PDB2_2015Mar16_22_02_38.log (no errors)
Patch 19769480 apply (pdb PDB2_2): SUCCESS
 logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/19769480/18350083/19769480_apply_CDB2_PDB2_2_2015Mar16_22_02_38.log (no errors)
Patch 19769480 apply (pdb PDB_ORCL2): SUCCESS
 logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/19769480/18350083/19769480_apply_CDB2_PDB_ORCL2_2015Mar16_22_02_39.log (no errors)
Patch 19769480 apply (pdb PDB1_1): SUCCESS
 logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/19769480/18350083/19769480_apply_CDB2_PDB1_1_2015Mar16_22_02_52.log (no errors)
Patch 19769480 apply (pdb PDB_SAMLES): SUCCESS
 logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/19769480/18350083/19769480_apply_CDB2_PDB_SAMLES_2015Mar16_22_02_51.log (no errors)
SQL Patching tool complete on Mon Mar 16 22:03:00 2015
[oracle@racnote1 OPatch]$ 


SQL> select VERSION,ACTION,STATUS,ACTION_TIME 
       from dba_registry_sqlpatch;

VERSION   ACTION  STATUS   ACTION_TIME
--------- ------- -------- -----------------------------
12.1.0.2  APPLY   SUCCESS  16-MAR-15 10.02.57.755324 PM

 Apply Oracle JavaVM Component 12.1.0.2.2 Database PSU (Jan2015)

1)Pre-check.

[oracle@racnode1 19877336]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.1.0.1.6
Copyright (c) 2015, Oracle Corporation. All rights reserved.

PREREQ session

Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version : 12.1.0.1.6
OUI version : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2015-03-16_22-08-46PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

2)  opatch apply.

3)  load modified SQL files into the database.

$sqlplus /nolog
SQL>connect / as sysdba
SQL> startup
$cd $ORACLE_HOME/OPatch
SQL> quit

SQL> alter pluggable database all open;
SQL> SELECT NAME,OPEN_MODE FROM V$PDBS;
NAME         OPEN_MODE
------------ ----------
PDB$SEED     READ ONLY
PDB2         READ WRITE
PDB2_2       READ WRITE
PDB_ORCL2    READ WRITE
PDB1_1       READ WRITE
PDB_SAMLES   READ WRITE

6 rows selected.

[oracle@racnote1 OPatch]$ ./datapatch -verbose

-----------------------------------------------------
There is an error for PDB2 pluggable databbase
-----------------------------------------------------

Patch 19877336 apply (pdb PDB2): WITH ERRORS
 logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/19877336/18313828/19877336_apply_CDB2_PDB2_2015Mar16_22_29_39.log (errors)
 Error at line 554: ORA-01652: unable to extend temp segment by 128 in tablespace TEMP_PDB2
 Error at line 555: ORA-06512: at line 10
----------------------------------------------------
----------------------------------------------------
To fix:
1) make tempfile autoextend on
2) rerun datapatch

SQL> alter session set container=pdb2;
Session altered.

SQL> show con_name
CON_NAME
------------
PDB2

SQL> select PATCH_ID,ACTION,STATUS,ACTION_TIME,DESCRIPTION
       from dba_registry_sqlpatch ;
 
PATCH_ID   ACTION   STATUS    ACTION_TIME                  DESCRIPTION
---------- -------- --------- ---------------------------  --------------
 19769480  APPLY    SUCCESS   16-MAR-15 10.02.58.791011 PM Database Patch Set Update : 12.1.0.2.2 (19769480)
 19877336  APPLY  WITH ERRORS 16-MAR-15 10.42.38.915032 PM Database PSU 12.1.0.2.2, Oracle JavaVM Component (
 19877336  APPLY     SUCCESS  16-MAR-15 11.34.24.408659 PM Database PSU 12.1.0.2.2, Oracle JavaVM Component ( 


SQL> alter session set container=cdb$root;
SQL> select PATCH_ID,ACTION,STATUS,ACTION_TIME,DESCRIPTION 
       from dba_registry_sqlpatch ;

PATCH_ID   ACTION   STATUS  ACTION_TIME                  DESCRIPTION
---------- -------- ------- ---------------------------  -------------

 19769480  APPLY   SUCCESS 16-MAR-15 10.02.57.755324 PM  Database Patch Set Update : 12.1.0.2.2 (19769480)
 19877336  APPLY   SUCCESS 16-MAR-15 10.42.37.649060 PM  Database PSU 12.1.0.2.2, Oracle JavaVM Component (