Applying patches
From dbawiki
- Find the patches on Metalink under the tab "Patches & Updates"
I find it easier to click the "Recommended Patch Advisor" tab and fill in the 3 fields. This will then find all relevant patches.
- After choosing the correct product, release and platform, click on the desired patch.
- Click on and read the README to understand if there are any special circumstances.
- Click on Download to download the patch.
- Copy the zip file to a place accessible to the server to be patched. Could be directly to the server, an NFS mount etc.
- If the patch is for a Grid Infrastructure ORACLE_HOME as well as a database ORACLE_HOME, the patch commands must be run as root.
If only a database ORACLE_HOME is patched, it will be run as the software owner (eg. oracle).
Patching both Grid and database ORACLE_HOMEs at the same time[edit]
When applying the 180718 PSU to both Grid and database infrastructure, the patch application log (/u01/app/oracle/product/11.2.0.4/grid/cfgtoollogs/opatch/opatch_history.txt) showed up the following commands:
opatch query -get_patch_type /oracle/Patches/27967757/27734982 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch query -get_patch_type /oracle/Patches/27967757/27441052 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch query -get_patch_type /oracle/Patches/27967757/27959254 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch util saveconfigurationsnapshot -configFile /u01/app/oracle/product/11.2.0.4/grid/cfgtoollogs/opatchauto2018-10-17_12-00-03.cfg.log -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch util checkMinimumOPatchVersion -ph /oracle/Patches/27967757/27734982 -version 11.2.0.3.6 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch util checkMinimumOPatchVersion -ph /oracle/Patches/27967757/27441052 -version 11.2.0.3.6 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch util checkMinimumOPatchVersion -ph /oracle/Patches/27967757/27959254 -version 11.2.0.3.6 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch prereq CheckComponents -ph /oracle/Patches/27967757/27734982 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch prereq CheckComponents -ph /oracle/Patches/27967757/27441052 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch prereq CheckComponents -ph /oracle/Patches/27967757/27959254 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch prereq CheckConflictAgainstOH -ph /oracle/Patches/27967757/27734982 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch prereq CheckConflictAgainstOH -ph /oracle/Patches/27967757/27441052 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch prereq CheckConflictAgainstOH -ph /oracle/Patches/27967757/27959254 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch prereq CheckApplicable -ph /oracle/Patches/27967757/27734982 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch prereq CheckApplicable -ph /oracle/Patches/27967757/27441052 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch prereq CheckApplicable -ph /oracle/Patches/27967757/27959254 -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch napply /oracle/Patches/27967757/27734982 -local -silent -ocmrf /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/ocm/bin/ocm.rsp -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch napply /oracle/Patches/27967757/27441052 -local -silent -ocmrf /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/ocm/bin/ocm.rsp -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch napply /oracle/Patches/27967757/27959254 -local -silent -ocmrf /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/ocm/bin/ocm.rsp -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc opatch lspatches -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc
opatch log report[edit]
Shows the steps involved in patching Grid and database ORACLE_HOMEs in auto mode.
/u01/app/oracle/product/11.2.0.4/grid/cfgtoollogs> cat opatchauto2018-10-17_12-00-03.report.log *********** Configuration Data *********** * It shows only those targets that will be patched in this session * crs_home=/u01/app/oracle/product/11.2.0.4/grid owner=oracle opatch_ver=11.2.0.3.6 rac_home=/u01/app/oracle/product/11.2.0.4/dbhome_1 owner=oracle opatch_ver=11.2.0.3.6 *********** Steps to be executed as owner unless specified as root *********** 1: /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch prereq CheckComponents -ph /oracle/Patches/27967757/27734982 -oh /u01/app/oracle/product/11.2.0.4/dbhome_1 2: /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch prereq CheckComponents -ph /oracle/Patches/27967757/27441052/custom/server/27441052 -oh /u01/app/oracle/product/11.2.0.4/dbhome_1 3: /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/Patches/27967757/27734982 -oh /u01/app/oracle/product/11.2.0.4/dbhome_1 4: /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/Patches/27967757/27441052/custom/server/27441052 -oh /u01/app/oracle/product/11.2.0.4/dbhome_1 5: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch prereq CheckComponents -ph /oracle/Patches/27967757/27734982 -oh /u01/app/oracle/product/11.2.0.4/grid 6: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch prereq CheckComponents -ph /oracle/Patches/27967757/27441052 -oh /u01/app/oracle/product/11.2.0.4/grid 7: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch prereq CheckComponents -ph /oracle/Patches/27967757/27959254 -oh /u01/app/oracle/product/11.2.0.4/grid 8: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/Patches/27967757/27734982 -oh /u01/app/oracle/product/11.2.0.4/grid 9: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/Patches/27967757/27441052 -oh /u01/app/oracle/product/11.2.0.4/grid 10: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch prereq CheckConflictAgainstOH -ph /oracle/Patches/27967757/27959254 -oh /u01/app/oracle/product/11.2.0.4/grid 11: /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/emctl stop dbconsole 12: /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/emctl stop agent 13: /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch prereq CheckApplicable -ph /oracle/Patches/27967757/27734982 -oh /u01/app/oracle/product/11.2.0.4/dbhome_1 14: /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch prereq CheckApplicable -ph /oracle/Patches/27967757/27441052/custom/server/27441052 -oh /u01/app/oracle/product/11.2.0.4/dbhome_1 15: /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/srvctl stop home -o /u01/app/oracle/product/11.2.0.4/dbhome_1 -s /u01/app/oracle/product/11.2.0.4/dbhome_1/srvm/admin/stophome.txt 16: /oracle/Patches/27967757/27441052/custom/server/27441052/custom/scripts/prepatch.sh -dbhome /u01/app/oracle/product/11.2.0.4/dbhome_1 17: /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch napply /oracle/Patches/27967757/27734982 -local -silent -ocmrf /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/ocm/bin/ocm.rsp -oh /u01/app/oracle/product/11.2.0.4/dbhome_1 -invPtrLoc /u01/app/oracle/product/11.2.0.4/dbhome_1/oraInst.loc 18: /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch napply /oracle/Patches/27967757/27441052/custom/server/27441052 -local -silent -ocmrf /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/ocm/bin/ocm.rsp -oh /u01/app/oracle/product/11.2.0.4/dbhome_1 -invPtrLoc /u01/app/oracle/product/11.2.0.4/dbhome_1/oraInst.loc 19: /oracle/Patches/27967757/27441052/custom/server/27441052/custom/scripts/postpatch.sh -dbhome /u01/app/oracle/product/11.2.0.4/dbhome_1 20: /u01/app/oracle/product/11.2.0.4/grid/crs/install/roothas.pl -unlock : run as root 21: /sbin/fuser -k /u01/app/oracle/product/11.2.0.4/grid/bin/crsctl.bin : run as root 22: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch prereq CheckApplicable -ph /oracle/Patches/27967757/27734982 -oh /u01/app/oracle/product/11.2.0.4/grid 23: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch prereq CheckApplicable -ph /oracle/Patches/27967757/27441052 -oh /u01/app/oracle/product/11.2.0.4/grid 24: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch prereq CheckApplicable -ph /oracle/Patches/27967757/27959254 -oh /u01/app/oracle/product/11.2.0.4/grid 25: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch napply /oracle/Patches/27967757/27734982 -local -silent -ocmrf /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/ocm/bin/ocm.rsp -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc 26: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch napply /oracle/Patches/27967757/27441052 -local -silent -ocmrf /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/ocm/bin/ocm.rsp -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc 27: /u01/app/oracle/product/11.2.0.4/grid/OPatch/opatch napply /oracle/Patches/27967757/27959254 -local -silent -ocmrf /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/ocm/bin/ocm.rsp -oh /u01/app/oracle/product/11.2.0.4/grid -invPtrLoc /u01/app/oracle/product/11.2.0.4/grid/oraInst.loc 28: /u01/app/oracle/product/11.2.0.4/grid/bin/emctl start dbconsole 29: /u01/app/oracle/product/11.2.0.4/grid/rdbms/install/rootadd_rdbms.sh : run as root 30: /u01/app/oracle/product/11.2.0.4/grid/crs/install/roothas.pl -patch : run as root 31: /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/emctl start dbconsole 32: /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/emctl start agent 33: /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/srvctl start home -o /u01/app/oracle/product/11.2.0.4/dbhome_1 -s /u01/app/oracle/product/11.2.0.4/dbhome_1/srvm/admin/stophome.txt
Opatch[edit]
As Oracle software owner:
export ORACLE_BASE=/oracle/product export PATH=$ORACLE_HOME/OPatch/bin:$PATH
Get the patch zip file and unzip it to the OPatch directory
cd /oracle/stage/112_64/11203 oracle@solax042:/oracle/stage/112_64/11203> ll total 15232 drwxr-xr-x 12 oracle dba 1024 May 04 00:49 . drwxrwxr-x 11 oracle dba 1024 Jun 25 17:38 .. drwxr-xr-x 4 oracle oinstall 512 Jan 13 2012 13443029 drwxr-xr-x 4 oracle oinstall 512 May 21 2012 13947840 drwxrwxr-x 29 oracle oinstall 1024 Dec 27 2012 14841409 drwxrwxr-x 33 oracle oinstall 1024 Mar 20 08:52 16294378 oracle@solax042:/oracle/stage/112_64/11203> cp -rp 16294378 $ORACLE_HOME/OPatch oracle@solax042:/oracle/stage/112_64/11203> cd $ORACLE_HOME/OPatch
Test the patch installation
oracle@solax042:/oracle/product/11.2.0.3/OPatch> cd 16294378 oracle@solax042:/oracle/product/11.2.0.3/OPatch/16294378> opatch napply -skip_subset -skip_duplicate -report -invPtrLoc $ORACLE_BASE/oraInst.loc Invoking OPatch 11.2.0.1.7 ...
Install the patch for real
oracle@solax042:/oracle/product/11.2.0.3/OPatch/16294378> opatch napply -skip_subset -skip_duplicate -invPtrLoc $ORACLE_BASE/oraInst.loc ... Patching component oracle.rdbms, 11.2.0.3.0... Patching component oracle.rdbms.rsf, 11.2.0.3.0... Applying interim patch '16314467' to OH '/oracle/product/11.2.0.3' ApplySession: Optional component(s) [ oracle.network.cman, 11.2.0.3.0 ] not present in the Oracle Home or a higher version is found. Patching component oracle.network.listener, 11.2.0.3.0... Patching component oracle.network.rsf, 11.2.0.3.0... Patching component oracle.rdbms, 11.2.0.3.0... Patching component oracle.rdbms.rsf, 11.2.0.3.0... Applying interim patch '16314468' to OH '/oracle/product/11.2.0.3' Patching component oracle.ovm, 11.2.0.3.0... Applying interim patch '16314469' to OH '/oracle/product/11.2.0.3' Patching component oracle.rdbms, 11.2.0.3.0... Applying interim patch '16314470' to OH '/oracle/product/11.2.0.3' Patching component oracle.sdo.locator, 11.2.0.3.0... Patches 13742433,13742434,13742435,13742436,13742438,13742464,14062792,14062794,14062795,14062796,14062797,14480674,14480675,14480676,14548763,14664355,15862016,15862017,15862018,15862019,15862020,15862021,15862022,15862023,15862024,16294378,16314466,16314467,16314468,16314469,16314470 successfully applied. Log file location: /oracle/product/11.2.0.3/cfgtoollogs/opatch/opatch2013-07-12_17-45-41PM.log OPatch succeeded.