* Find the patches on Metalink under the tab [[https://support.oracle.com/epmos/faces/PatchHome|"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 ===== * [[http://oradbapro.blogspot.com/2015/07/how-to-use-opatch-auto.html|how to use opatch auto]] 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 ==== 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 ==== 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. ==== Applying a one-off patch in version 19.17 ==== # ====================================== # stop all listeners in this ORACLE_HOME # ====================================== lsnrctl stop LSNR_HN481_1521 lsnrctl stop LSNR_HN481_1525 lsnrctl stop LSNR_HN481_3527 lsnrctl stop LSNR_HN481_3529 lsnrctl stop LSNR_HN481_3531 # this doesn't work export SID_LIST=$(awk -F: ' {{$2 ~ /19.17/} print $1}' /etc/oratab|grep -Ev "OH19") # ====================================== # stop all databases in this ORACLE_HOME # ====================================== export SID_LIST=$(grep '19\.17' /etc/oratab|awk -F: '{print $1}') for ORACLE_SID in ${SID_LIST}; do cat <"/tmp/patch_databases_stop_db_${ORACLE_SID}.ksh" #!/usr/bin/env ksh ORAENV_ASK=NO ORACLE_SID="${ORACLE_SID}" . oraenv >/dev/null [[ "\$?" -ne 0 ]] && echo "ERROR: Cannot set environment for \${ORACLE_SID}" && exit 1 echo "create pfile from spfile;"|sqlplus -s / as sysdba echo "shutdown immediate;"|sqlplus -s / as sysdba rm -f /tmp/patch_databases_stop_db_${ORACLE_SID}.ksh EOCAT chmod 744 "/tmp/patch_databases_stop_db_${ORACLE_SID}.ksh" echo "Logging /tmp/patch_databases_stop_db_${ORACLE_SID}.ksh to /tmp/patch_databases_stop_db_${ORACLE_SID}.log" ksh "/tmp/patch_databases_stop_db_${ORACLE_SID}.ksh" >"/tmp/patch_databases_stop_db_${ORACLE_SID}.log" & done echo "INFO: Waiting for all the instances to shutdown..." wait # ====================================== # apply the patch # ====================================== mkdir "${ORACLE_HOME}/Patches/32727143" cd "${ORACLE_HOME}/Patches/32727143" unzip /oracle/Patches/p32727143_1917000DBRU_AIX64-5L.zip -d ./ cd "32727143" opatch prereq CheckConflictAgainstOHWithDetail -ph ./ opatch lsinventory >"${ORACLE_HOME}/Patches/32727143/lsinventory.before" opatch apply opatch lsinventory >"${ORACLE_HOME}/Patches/32727143/lsinventory.after" # ======================================= # start all databases in this ORACLE_HOME # ======================================= cd "${ORACLE_HOME}" export SID_LIST=$(grep '19\.17' /etc/oratab|awk -F: '{print $1}') for ORACLE_SID in ${SID_LIST}; do cat <"/tmp/patch_databases_start_db_${ORACLE_SID}.ksh" #!/usr/bin/env ksh ORAENV_ASK=NO ORACLE_SID="${ORACLE_SID}" . oraenv >/dev/null [[ "\$?" -ne 0 ]] && echo "ERROR: Cannot set environment for \${ORACLE_SID}" && exit 1 cd "\${ORACLE_HOME}" echo "startup;"|sqlplus -s / as sysdba rm /tmp/patch_databases_start_db_${ORACLE_SID}.ksh EOCAT chmod 744 "/tmp/patch_databases_start_db_${ORACLE_SID}.ksh" echo "Logging /tmp/patch_databases_start_db_${ORACLE_SID}.ksh to /tmp/patch_databases_start_db_${ORACLE_SID}.log" ksh "/tmp/patch_databases_start_db_${ORACLE_SID}.ksh" >"/tmp/patch_databases_start_db_${ORACLE_SID}.log" & done echo "INFO: Waiting for all the instances to startup..." wait ls -al /tmp/patch_databases_start_db*ksh 2>/dev/null [[ "$?" -eq 0 ]] && slow "WARNING: Database start scripts still running. Should not be the case!" ps -ef|grep [p]mon >/tmp/pmon_listing for ORACLE_SID in ${SID_LIST}; do grep "${ORACLE_SID}" /tmp/pmon_listing >/dev/null 2>&1 [[ "$?" -ne 0 ]] && slow "WARNING: Instance ${ORACLE_SID} has not restarted. Please check later" done rm /tmp/pmon_listing # =========================================== # datapatch all databases in this ORACLE_HOME # =========================================== TS="$(date '+%Y%m%d')" export SID_LIST=$(grep '19\.17' /etc/oratab|awk -F: '{print $1}') ORAENV_ASK=NO for i in ${SID_LIST}; do export ORACLE_SID=${i} . oraenv >/dev/null [[ "$?" -ne 0 ]] && echo "ERROR: Cannot set environment for ${i}" && exit 1 echo "create or replace directory OPATCH_INST_DIR as '${ORACLE_HOME}/OPatch';"|sqlplus -s / as sysdba echo "create or replace directory OPATCH_SCRIPT_DIR as '${ORACLE_HOME}/QOpatch';"|sqlplus -s / as sysdba echo "create or replace directory OPATCH_LOG_DIR as '${ORACLE_HOME}/rdbms/log/QOpatch';"|sqlplus -s / as sysdba echo "INFO: datapatching ${i}" datapatch -verbose >"${ORACLE_HOME}/log/datapatch/datapatch_${i}_${TS}.log" 2>&1 & done echo "INFO: Waiting for all the datapatches to finish..." wait # check the logfiles for errors # check all databases are up correctly # ======================================= # start all listeners in this ORACLE_HOME # ======================================= lsnrctl start LSNR_HN481_1521 lsnrctl start LSNR_HN481_1525 lsnrctl start LSNR_HN481_3527 lsnrctl start LSNR_HN481_3529 lsnrctl start LSNR_HN481_3531