Online patch to multiple databases in the same home?



We often have many databases running out of the same home which begs the question - how do you apply the patch to all of the databases 'online' - by default you only seem to be able to supply one connect string. How do you patch the other ones - do they have to be restarted to pick up the change - can only one be truly online?

Jumping ahead the answer is yes they can be done online (as you would expect) - the syntax for opatch is just a little different though - lets take an example from the patch 16392079 which is a fix for some resource manager issues.

First up we get the patch from MOS - copy to the server and then unzip

[oracle@server]:DATABASE1D:/tmp# unzip p16392079_1120211_Linux-x86-64.zip
Archive:  p16392079_1120211_Linux-x86-64.zip
   creating: 16392079/
   creating: 16392079/online/
   creating: 16392079/online/files/
   creating: 16392079/online/files/hpatch/
  inflating: 16392079/online/files/hpatch/bug16392079.pch
   creating: 16392079/online/etc/
   creating: 16392079/online/etc/config/
  inflating: 16392079/online/etc/config/deploy.xml
  inflating: 16392079/online/etc/config/actions.xml
  inflating: 16392079/online/etc/config/inventory.xml
   creating: 16392079/online/etc/xml/
  inflating: 16392079/online/etc/xml/ShiphomeDirectoryStructure.xml
  inflating: 16392079/online/etc/xml/GenericActions.xml
  inflating: 16392079/README.txt
   creating: 16392079/etc/
   creating: 16392079/etc/xml/
  inflating: 16392079/etc/xml/ShiphomeDirectoryStructure.xml
  inflating: 16392079/etc/xml/GenericActions.xml
   creating: 16392079/etc/config/
  inflating: 16392079/etc/config/inventory.xml
  inflating: 16392079/etc/config/deploy.xml
  inflating: 16392079/etc/config/actions.xml
   creating: 16392079/files/
   creating: 16392079/files/lib/
   creating: 16392079/files/lib/libserver11.a/
  inflating: 16392079/files/lib/libserver11.a/ksk.o



We then cd into the patch directory as normal



[oracle@server]:DATABASE1D:/tmp# cd 16392079/



And then we run opatch with the online option to apply this to DATABASE1D


[oracle@server]:DATABASE1D:/tmp/16392079# $ORACLE_HOME/OPatch/opatch apply online -connectString DATABASE1D
Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/11.2.0.2.11.DB
Central Inventory : /oracle/oraInventory
   from           : /oracle/11.2.0.2.11.DB/oraInst.loc
OPatch version    : 11.2.0.3.4
OUI version       : 11.2.0.2.0
Log file location : /oracle/11.2.0.2.11.DB/cfgtoollogs/opatch/16392079_Mar_10_2014_13_02_04/apply2014-03-10_13-02-04PM_1.log


The patch should be applied/rolled back in '-all_nodes' mode only.
Converting the RAC mode to '-all_nodes' mode.
Applying interim patch '16392079' to OH '/oracle/11.2.0.2.11.DB'
Verifying environment and performing prerequisite checks...
All checks passed.
Provide your email address to be informed of security issues, install 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


Backing up files...

Patching component oracle.rdbms, 11.2.0.2.0...
Installing and enabling the online patch 'bug16392079.pch', on database 'DATABASE1D'.


Verifying the update...
Patch 16392079 successfully applied
Log file location: /oracle/11.2.0.2.11.DB/cfgtoollogs/opatch/16392079_Mar_10_2014_13_02_04/apply2014-03-10_13-02-04PM_1.log

OPatch succeeded.
[oracle@server]:DATABASE1D:/tmp/16392079# vi /oracle/11.2.0.2.11.DB/cfgtoollogs/opatch/16392079_Mar_10_2014_13_02_04/apply2014-03-10_13-02-04PM_1.log




So all applied fine to that database and we can see that it applied it by running the following command and sifting through the extensive output to look for the 'Instances Patched ' section

 [oracle@server]:DATABASE1D:/opatch lsinventory -detail

Interim patches (3) :

Patch (online) 16392079: applied on Mon Mar 10 13:02:31 CET 2014
Unique Patch ID:  16546704
   Created on 7 Jul 2013, 07:45:10 hrs PST8PDT
   Bugs fixed:
     16392079
   This patch overlays patches:
     16619893
   This patch needs patches:
     16619893
   as prerequisites
   Files Touched:
     bug16392079.pch --> ORACLE_HOME/hpatch/bug16392079.pch
   Instances Patched:
     DATABASE1D
   Patch Location in Inventory:
     /oracle/11.2.0.2.11.DB/inventory/oneoffs/16392079
   Patch Location in Storage area:
     /oracle/11.2.0.2.11.DB/.patch_storage/16392079_Jul_7_2013_07_45_10


So that's all marvelous and everything but what about poor old DATABASE2D - am i going to have to restart that to pick up this change? After much trial and erro i finally found the right syntax which is shown below. Note we have to use a different opatch command and explictly mention the patch id - it will not default to the directory you are in when you first applied the patch.

[oracle@server]:DATABASE2D:/tmp/16392079# $ORACLE_HOME/OPatch/opatch util enableOnlinePatch  -connectString DATABASE2D -id 16392079

Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/11.2.0.2.11.DB
Central Inventory : /oracle/oraInventory
   from           : /oracle/11.2.0.2.11.DB/oraInst.loc
OPatch version    : 11.2.0.3.4
OUI version       : 11.2.0.2.0
Log file location : /oracle/11.2.0.2.11.DB/cfgtoollogs/opatch/opatch2014-03-10_15-46-55PM_1.log

Invoking utility "enableonlinepatch"
Installing and enabling the online patch 'bug16392079.pch', on database 'DATABASE2D'.


OPatch succeeded.
[oracle@server]:DATABASE2D:/tmp/16392079#



A check from lsinventory now shows Instances patched now contains the extra instance.

Comments