oracledba.help
Install

OPatch, Updating

Overview

The following covers updating OPatch to the latest version. For RAC environments you must update OPatch in both the oracle user and grid user homes on all nodes. 12c Session here.

Prerequisites

  • Determine your version:
    $ORACLE_HOME/OPatch/opatch lsinventory
  • Get the latest OPatch here.
    • Select a Release that matches your database version.
    • Example:
      • OPatch 12.2.0.1.40 for DB 19.0.0.0.0 (Mon YYYY)
      • Opatch 19.0.0.0.0
      • Linux x86-64
    • Per Oracle (3-18615460221), for 12.1.0.2 select "Oracle 12.1.0.1.0".

19c Session

Copy to System

 su -
 mkdir -p /u01/orasw/patches/OPatch/latest
 cd /u05/patches/OPatch/12.2.0.1.40
 cp p6880880_190000_Linux-x86-64.zip /u01/orasw/patches/OPatch/latest/
 cd /u01/orasw/patches/OPatch/latest
 chown oracle:oinstall p6880880_190000_Linux-x86-64.zip

If RAC, perform above on all nodes.

Update

 su - oracle
 mv $ORACLE_HOME/OPatch $ORACLE_HOME/zOPatch_$(date "+%Y%m%d%H%M")
 cd /u01/orasw/patches/OPatch/latest/
 cp p6880880_190000_Linux-x86-64.zip $ORACLE_HOME/
 cd $ORACLE_HOME
 unzip p6880880_190000_Linux-x86-64.zip
 $ORACLE_HOME/OPatch/opatch lsinventory|more

 Oracle Interim Patch Installer version 12.2.0.1.40
 ...
 OPatch version    : 12.2.0.1.40

If RAC, perform above on all nodes.

If RAC - Perform These Steps

 su -
 export GRID_HOME=/u01/app/19.3.0.0.0/grid
 cd $GRID_HOME
 mv OPatch zOPatch_$(date "+%Y%m%d%H%M")
 mkdir OPatch
 chown grid:oinstall OPatch

 export OP_DIR=/u01/orasw/patches/OPatch/latest
 cp $OP_DIR/p6880880_190000_Linux-x86-64.zip $GRID_HOME/
 chown grid:oinstall $GRID_HOME/p6880880_190000_Linux-x86-64.zip

 su - grid
 cd $ORACLE_HOME
 unzip p6880880_190000_Linux-x86-64.zip
 $ORACLE_HOME/OPatch/opatch lsinventory|more

If RAC, perform above on all nodes.


Oracle-Restart

 su -
 cd /u01/app/grid/product/12.1.0.2/grid
 mv OPatch zOPatch_$(date "+%Y%m%d%H%M")
 mkdir OPatch
 chown grid:oinstall OPatch

 cp /u01/orasw/patches/OPatch/12.2.0.1.40/p6880880_121010_Linux-x86-64.zip 
    /u01/app/grid/product/12.1.0.2/grid/
 chown grid:oinstall /u01/app/grid/product/12.1.0.2/grid/p6880880_121010_Linux-x86-64.zip

 su - grid
 cd $ORACLE_HOME
 unzip p6880880_121010_Linux-x86-64.zip

 $ORACLE_HOME/OPatch/opatch lsinventory|more

Common Errors

OPatch cannot continue because it would not be able to load OUI...

$ORACLE_HOME/OPatch/opatch lsinventory

OPatch cannot continue because it would not be able to load OUI platform dependent library 
from the directory "/u01/app/12.1.0.2/grid/oui/lib/linux". The directory does not exist in 
the Oracle home.

This could be due to the following reasons.
(1) Incompatible usage of java with OUI (32/64 bit).
(2) Wrong 32-bit Oracle Home installation in 64-bit environment (or) vice-versa.
Please contact Oracle support for more details.

OPatch failed with error code 1

Solution

You probably downloaded the wrong version. Make sure to get the 64-bit version.

Wrong Version

 Linux x86

Correct Version

 Linux x86-x64

Example file: p6880880_121010_Linux-x86-64.zip


12.1 Session

Copy to System

 su - oracle
 mkdir -p /u01/orasw/patches/OPatch/ 
 cp /media/sf_sw/Oracle/OPatch/Latest/p6880880_121010_Linux-x86-64.zip /u01/orasw/patches/OPatch/
 cd /u01/orasw/patches/OPatch/ 
 ls -l 

Update

 su - oracle
 mv $ORACLE_HOME/OPatch $ORACLE_HOME/zOPatch_$(date "+%Y%m%d%H%M")
 cp /u01/orasw/patches/OPatch/p6880880_121010_Linux-x86-64.zip $ORACLE_HOME/
 cd $ORACLE_HOME
 unzip p6880880_121010_Linux-x86-64.zip
 $ORACLE_HOME/OPatch/opatch lsinventory|more

 If RAC Used - Perform These Steps Next
 su -
 cd /u01/app/12.1.0.2/grid
 mv OPatch zOPatch_$(date "+%Y%m%d%H%M")
 mkdir OPatch
 chown grid:oinstall OPatch

 cp /u01/orasw/patches/OPatch//p6880880_121010_Linux-x86-64.zip 
    /u01/app/12.1.0.2/grid/
 chown grid:oinstall /u01/app/12.1.0.2/grid/p6880880_121010_Linux-x86-64.zip

 su - grid
 cd $ORACLE_HOME
 unzip p6880880_121010_Linux-x86-64.zip
 $ORACLE_HOME/OPatch/opatch lsinventory|more

For Oracle-Restart 12.1 go here.

Confirm Version

Run for each user\home (grid, oracle).
$ORACLE_HOME/OPatch/opatch lsinventory|more

 Oracle Interim Patch Installer version 12.2.0.1.40
 Copyright (c) 2018, Oracle Corporation.  All rights reserved. 

 Oracle Home       : /u01/app/oracle/product/12.1.0.2/dbhome_1
 Central Inventory : /u01/app/oraInventory
    from           : /u01/app/oracle/product/12.1.0.2/dbhome_1/oraInst.loc
 OPatch version    : 12.2.0.1.40
 OUI version       : 12.1.0.2.0

Reference

  • 274526.1