Steps to Apply OJVM PSU Patch in Oracle 12c Database

Below are the steps for applying Oracle JVM patch in 12c Database. It can be used for container database PDB, CDB and standalone.

STEP 1: Search and download patch from Oracle support Site.

 Unzip Patch and goto the patch directory.

bash-4.2$  unzip -d p29774383_12102_.zip
bash-4.2$ pwd
/scratch/stage/JUL2019CPU/29699220/29774383

STEP 2: Check supported OPatch utility version before applying this patch.

You must use the OPatch utility version 12.2.0.1.8 or later to apply this patch. Oracle recommends that you use the latest released OPatch version for 12.1, which is available for download from My Oracle Support patch 6880880 by selecting the 12.1.0.1.0 release.

 bash-4.2$ export ORACLE_HOME= /scratch/oemora/app/product/12.1.0/dbhome_1 
bash-4.2$ export PATH=$ORACLE_HOME/bin:$PATH:.
export ORACLE_SID=db12c
bash-4.2$
bash-4.2$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.2.0.1.17
OPatch succeeded.

You can download Latest supported OPatch version from here – 6880880

Steps to install OPatch, if it is not supported.

1. Goto ORACLE_HOME and backup the existing OPatch folder.
bash-4.2$ pwd
/scratch/oemora/app/product/12.1.0/dbhome_1
bash-4.2$ mv OPatch OPatch_BKP

2. Unzip the opatch 
bash-4.2$ unzip p6880880_122010_Linux-x86-64.zip

3. Check the version.
bash-4.2$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.2.0.1.17
OPatch succeeded.

STEP 3: Check conflicts against oracle home.

bash-4.2$ $ORACLE_HOME/OPatch/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 : /scratch/oemora/app/product/12.1.0/dbhome_1
Central Inventory : /scratch/gbuora/oraInventory
from : /scratch/oemora/app/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 : /scratch/oemora/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2019-09-16_10-30-18AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.

STEP 4: Shutdown database and the listener.

 lsnrctl stop
shut immediate

STEP 5: Backup ORACLE_HOME and inventory

STEP 6: Check active files and executable.

bash-4.2$ $ORACLE_HOME/OPatch/opatch prereq CheckActiveFilesAndExecutables -ph ./
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2019, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /scratch/oemora/app/product/12.1.0/dbhome_1
Central Inventory : /scratch/gbuora/oraInventory
from : /scratch/oemora/app/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 : /scratch/oemora/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2019-09-16_10-30-40AM_1.log
Invoking prereq "checkactivefilesandexecutables"
Prereq "checkActiveFilesAndExecutables" for patch 19769480 passed.
Prereq "checkActiveFilesAndExecutables" for patch 20299023 passed.
Prereq "checkActiveFilesAndExecutables" for patch 20831110 passed.
Prereq "checkActiveFilesAndExecutables" for patch 21359755 passed.
Prereq "checkActiveFilesAndExecutables" for patch 21948354 passed.
Prereq "checkActiveFilesAndExecutables" for patch 22291127 passed.
Prereq "checkActiveFilesAndExecutables" for patch 23054246 passed.
Prereq "checkActiveFilesAndExecutables" for patch 24006101 passed.
Prereq "checkActiveFilesAndExecutables" for patch 24732082 passed.
Prereq "checkActiveFilesAndExecutables" for patch 25171037 passed.
Prereq "checkActiveFilesAndExecutables" for patch 25755742 passed.
Prereq "checkActiveFilesAndExecutables" for patch 26609783 passed.
Prereq "checkActiveFilesAndExecutables" for patch 26713565 passed.
Prereq "checkActiveFilesAndExecutables" for patch 26925311 passed.
Prereq "checkActiveFilesAndExecutables" for patch 27338041 passed.
Prereq "checkActiveFilesAndExecutables" for patch 27547329 passed.
Prereq "checkActiveFilesAndExecutables" for patch 28259833 passed.
Prereq "checkActiveFilesAndExecutables" for patch 28729169 passed.
Prereq "checkActiveFilesAndExecutables" for patch 29141015 passed.
Prereq "checkActiveFilesAndExecutables" for patch 29494060 passed.
OPatch succeeded.

STEP 7: Goto patch directory and apply the patch.

cd /scratch/stage/JUL2019CPU/29699220/29774383
bash-4.2$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2019, Oracle Corporation. All rights reserved.
Oracle Home : /scratch/oemora/app/product/12.1.0/dbhome_1
Central Inventory : /scratch/gbuora/oraInventory
from : /scratch/oemora/app/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 : /scratch/oemora/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2019-09-16_10-51-25AM_1.log
Verifying environment and performing prerequisite checks…
OPatch continues with these patches: 29774383
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/scratch/oemora/app/product/12.1.0/dbhome_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files…
Applying interim patch '29774383' to OH '/scratch/oemora/app/product/12.1.0/dbhome_1'
ApplySession: Optional component(s) [ oracle.sqlj, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.javavm.server, 12.1.0.2.0…
Patching component oracle.javavm.server.core, 12.1.0.2.0…
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0…
Patching component oracle.rdbms, 12.1.0.2.0…
Patching component oracle.javavm.client, 12.1.0.2.0…
Patching component oracle.dbjava.jdbc, 12.1.0.2.0…
Patching component oracle.dbjava.ic, 12.1.0.2.0…
Patch 29774383 successfully applied.
Log file location: /scratch/oemora/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2019-09-16_10-51-25AM_1.log
OPatch succeeded.

Post Patch Steps:

SQL> Connect / as sysdba
Connected to an idle instance.
SQL> startup upgrade
ORACLE instance started.
Total System Global Area 1.2583E+10 bytes
Fixed Size 3724784 bytes
Variable Size 7516195344 bytes
Database Buffers 5033164800 bytes
Redo Buffers 29827072 bytes
Database mounted.
Database opened.

Opne PDB in upgrade mode, if standalone proceed for rest of the steps.
SQL> alter pluggable database all open upgrade;


SQL> quit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
bash-4.2$ cd $ORACLE_HOME/OPatch

bash-4.2$ ./datapatch -verbose
SQL Patching tool version 12.1.0.2.0 Production on Mon Sep 16 10:59:30 2019
Copyright (c) 2012, 2016, Oracle. All rights reserved.
Log file for this invocation: /scratch/oemora/app/cfgtoollogs/sqlpatch/sqlpatch_94094_2019_09_16_10_59_30/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 not installed in any PDB
Adding patches to installation queue and performing prereq checks…
Installation queue:
For the following PDBs: CDB$ROOT PDB$SEED CLINICALONE ORACLE C1_PDBNA C1_PDB1 C1_PDB9 C1_PDB6 C1_PDB7 C1_PDB3 C1_PDB4
Nothing to roll back
The following patches will be applied:
29774383 (Database PSU 12.1.0.2.190716, Oracle JavaVM Component (JUL2019))
29494060 (DATABASE PATCH SET UPDATE 12.1.0.2.190716)
Installing patches…
Patch installation complete. Total patches installed: 22
Validating logfiles…
Patch 29774383 apply (pdb CDB$ROOT): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_ORCL_CDBROOT_2019Sep16_11_00_31.log (no errors)
Patch 29494060 apply (pdb CDB$ROOT): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_ORCL_CDBROOT_2019Sep16_11_01_43.log (no errors)
Patch 29774383 apply (pdb PDB$SEED): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_ORCL_PDBSEED_2019Sep16_11_02_33.log (no errors)
Patch 29494060 apply (pdb PDB$SEED): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_ORCL_PDBSEED_2019Sep16_11_04_01.log (no errors)
Patch 29774383 apply (pdb CLINICALONE): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_ORCL_CLINICALONE_2019Sep16_11_02_33.log (no errors)
Patch 29494060 apply (pdb CLINICALONE): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_ORCL_CLINICALONE_2019Sep16_11_03_57.log (no errors)
Patch 29774383 apply (pdb ORACLE): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_ORCL_ORACLE_2019Sep16_11_02_33.log (no errors)
Patch 29494060 apply (pdb ORACLE): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_ORCL_ORACLE_2019Sep16_11_03_39.log (no errors)
Patch 29774383 apply (pdb C1_PDBNA): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_ORCL_C1_PDBNA_2019Sep16_11_02_33.log (no errors)
Patch 29494060 apply (pdb C1_PDBNA): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_ORCL_C1_PDBNA_2019Sep16_11_03_56.log (no errors)
Patch 29774383 apply (pdb C1_PDB1): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_ORCL_C1_PDB1_2019Sep16_11_02_33.log (no errors)
Patch 29494060 apply (pdb C1_PDB1): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_ORCL_C1_PDB1_2019Sep16_11_03_34.log (no errors)
Patch 29774383 apply (pdb C1_PDB9): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_ORCL_C1_PDB9_2019Sep16_11_02_33.log (no errors)
Patch 29494060 apply (pdb C1_PDB9): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_ORCL_C1_PDB9_2019Sep16_11_03_38.log (no errors)
Patch 29774383 apply (pdb C1_PDB6): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_ORCL_C1_PDB6_2019Sep16_11_02_33.log (no errors)
Patch 29494060 apply (pdb C1_PDB6): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_ORCL_C1_PDB6_2019Sep16_11_03_38.log (no errors)
Patch 29774383 apply (pdb C1_PDB7): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_ORCL_C1_PDB7_2019Sep16_11_02_33.log (no errors)
Patch 29494060 apply (pdb C1_PDB7): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_ORCL_C1_PDB7_2019Sep16_11_03_45.log (no errors)
Patch 29774383 apply (pdb C1_PDB3): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_ORCL_C1_PDB3_2019Sep16_11_02_33.log (no errors)
Patch 29494060 apply (pdb C1_PDB3): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_ORCL_C1_PDB3_2019Sep16_11_04_01.log (no errors)
Patch 29774383 apply (pdb C1_PDB4): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29774383/22961858/29774383_apply_ORCL_C1_PDB4_2019Sep16_11_02_33.log (no errors)
Patch 29494060 apply (pdb C1_PDB4): SUCCESS
logfile: /scratch/oemora/app/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_ORCL_C1_PDB4_2019Sep16_11_04_01.log (no errors)
SQL Patching tool complete on Mon Sep 16 11:05:01 2019

bash-4.2$ sqlplus /nolog
SQL*Plus: Release 12.1.0.2.0 Production on Mon Sep 16 11:06:50 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
SQL> Connect / as sysdba
Connected.

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

SQL> startup
ORACLE instance started.
Total System Global Area 1.2583E+10 bytes
Fixed Size 3724784 bytes
Variable Size 8086620688 bytes
Database Buffers 4462739456 bytes
Redo Buffers 29827072 bytes
Database mounted.
Database opened.

SQL> alter pluggable database all open; --Run if 12c is pdb.
Pluggable database altered.

Compile invalid objects:

After installing the SQL portion of the patch, some packages could become INVALID. This will get recompiled upon access or you can run utlrp.sql to get them back into a VALID state.

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql

Check lsinventory to check latest applied patch.

[gbuora@den02naq 29774383]$ $ORACLE_HOME/OPatch/opatch lsinventory

To Deinstall or rollback :

Deinstall the patch by running the following command:
$ opatch rollback -id 29774383

All the steps has been completed and oracle JVM patch has been applied on 12c database.