Recently we got a notification from security Team, that the java versions inside the ORACLE_HOME were outdated, and those need to be updated to the latest one. So We checked in  oracle support portal and found out what is the latest jdk patch available and then applied the same on respective servers.

In this below example we will show how to apply the jdk patch for standalone and grid database

1. Find the latest jdk patch available.

JDK and PERL Patches for Oracle Database Home and Grid Home (Doc ID 2584628.1)

 

Download the jdk patch for your respective database version and copy the zip file to your db server.

 Steps for applying jdk patch on  standalone database:

 

For standalone database, we need to apply only to the database_home i.e is the rdbms home.

1. Check the existing jdk version:


[oracle@dbhost-1 bin]$ /u01/app/oracle/product/12.2/dbhome_1/jdk/bin/java -version
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)

2. Shutdown database


SQL> SHUTDOWN IMMEDIATE;

3. unzip the patch:


cd /backup/software/
unzip 32162748_patch.zip
cd 32162748

4. Apply the patch:

Note –  > Please ensure that latest opatch utility installed.


export ORACLE_HOME=/u01/app/oracle/product/12.2/dbhome_1
cd /backup/software/32162748


[oracle@dbhost-1 32162748]$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.23
Copyright (c) 2021, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/12.2/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.2/dbhome_1//oraInst.loc
OPatch version    : 12.2.0.1.23
OUI version       : 12.2.0.1.4
Log file location : /u01/app/oracle/product/12.2/dbhome_1/cfgtoollogs/opatch/opatch2021-03-25_12-57-53PM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   32162748

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Backing up files...
Applying interim patch '32162748' to OH '/u01/app/oracle/product/12.2/dbhome_1'

Patching component oracle.jdk, 1.8.0.91.0...
Patch 32162748 successfully applied.
Log file location: /u01/app/oracle/product/12.2/dbhome_1/cfgtoollogs/opatch/opatch2021-03-25_12-57-53PM_1.log

OPatch succeeded.

5. Start the database:



SQL> startup
ORACLE instance started.

Total System Global Area 1.6267E+11 bytes
Fixed Size                 29864856 bytes
Variable Size            3.4897E+10 bytes
Database Buffers         1.2724E+11 bytes
Redo Buffers              507002880 bytes
Database mounted.
Database opened.
SQL>

6. Now check the jdk version again:


[oracle@dbhost-1 32162748]$  /u01/app/oracle/product/12.2/dbhome_1/jdk/bin/java -version
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)

We can see JDK has version has been change from 1.8.0_271 to 1.8.0_281

Steps for Applying JDK patch on GRID /RAC database:

In case of RAC database, we need to apply jdk patch on both RDBMS home and GRID home.

First we will start with GRID_HOME on node 1:

1. Unlock the crs: [ from root]

[root@dbhost-1]# cd $GRID_HOME/crs/install
[root@dbhost-1 install]# ./rootcrs.sh -prepatch
Using configuration parameter file: /u01/app/12.2/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/grid/crsdata/dbhost-1/crsconfig/crspatch_2021-03-25_01-02-53PM.log
2021/03/25 13:03:14 CLSRSC-347: Successfully unlock /u01/app/12.2/grid

NOTE –  > In case of standalone grid , use roothas.sh – prepatch command

2. Apply the patch on grid_home:


[oracle@dbhost-1 32162748]$ cd /backup/software/32162748
[oracle@dbhost-1 32162748]$
[oracle@dbhost-1 32162748]$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.23
Copyright (c) 2021, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/12.2/grid
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/12.2/grid/oraInst.loc
OPatch version    : 12.2.0.1.23
OUI version       : 12.2.0.1.4
Log file location : /u01/app/12.2/grid/cfgtoollogs/opatch/opatch2021-03-25_13-04-13PM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   32162748

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Backing up files...
Applying interim patch '32162748' to OH '/u01/app/12.2/grid'

Patching component oracle.jdk, 1.8.0.91.0...
Patch 32162748 successfully applied.
Log file location: /u01/app/12.2/grid/cfgtoollogs/opatch/opatch2021-03-25_13-04-13PM_1.log

OPatch succeeded.

3. Now lock the CRS: [ from root ]

[root@dbhost-1]# cd $GRID_HOME/crs/install
[root@dbhost-1 install]# ./rootcrs.sh -postpatch
Using configuration parameter file: /u01/app/12.2/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/grid/crsdata/dbhost-1/crsconfig/crspatch_2021-03-25_01-04-55PM.log
2021/03/25 13:04:57 CLSRSC-329: Replacing Clusterware entries in file '.....'


NOTE –  > In case of standalone grid , use roothas.sh – postpatch command

4. Now on RDBMS HOME on node 1:



SQL>shutdown immediate
SQL> exit


export ORACLE_HOME=/u01/app/oracle/product/12.2/dbhome_1
cd /backup/software/32162748


[oracle@dbhost-1 32162748]$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.23
Copyright (c) 2021, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/12.2/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.2/dbhome_1//oraInst.loc
OPatch version    : 12.2.0.1.23
OUI version       : 12.2.0.1.4
Log file location : /u01/app/oracle/product/12.2/dbhome_1/cfgtoollogs/opatch/opatch2021-03-25_12-57-53PM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   32162748

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Backing up files...
Applying interim patch '32162748' to OH '/u01/app/oracle/product/12.2/dbhome_1'

Patching component oracle.jdk, 1.8.0.91.0...
Patch 32162748 successfully applied.
Log file location: /u01/app/oracle/product/12.2/dbhome_1/cfgtoollogs/opatch/opatch2021-03-25_12-57-53PM_1.log

OPatch succeeded.


SQL> startup
ORACLE instance started.

Total System Global Area 1.6267E+11 bytes
Fixed Size                 29864856 bytes
Variable Size            3.4897E+10 bytes
Database Buffers         1.2724E+11 bytes
Redo Buffers              507002880 bytes
Database mounted.
Database opened.
SQL>


Once both grid_home and rdbms_home patching is done, we need to do the same steps on other node also.