Steps to Apply Patch on DB Home
This document shows how to apply patch on Oracle home / databases.
July 2019 PSU for Oracle databases.
Below patches are only for oracle database home if you want to apply on GRID then GI patch is difference and steps are as well.
Patch ID details
Patch 29834717 – Database Release Update 19.4.0.0.190716 ==> 19c
Patch 29757256 – Database Release Update 18.7.0.0.190716 ==> 18c
Patch 29757449 – Database Release 12.2.0.1.190716 ==> 12.2.0.1
Patch 29494060 – Database Patch Set Update 12.1.0.2.190716 ==> 12.1.0.2
The next four dates for Critical Patch Updates are:
October 15, 2019
January 14, 2020
April 14, 2020
July 14, 2020
Prerequisites
1. Go to Patch location and make sure download / copy correct patch and unzip it which depends on OS platform type & DB version.
1 2 3 | mkdir -p /home/oracle/12.1.0.2_patch_jul2019 cd /home/oracle/12.1.0.2_patch_jul2019/ ls -lrt |
2. Download patch as require and make sure you have downloaded correct patch version for specific OS type & DB version. Here I am showing for Linux 64 Bit and database version is 12.2.0.1
1 2 3 4 | unzip 29757449_121020_Linux-x86-64.zip ls -lrt cd 29757449 ls -lrt |
3. Capture information of running instances, listener, patch inventory, oratab & backup of associated ORACLE_HOME (In RAC Instances, execute on all available nodes)
1 2 3 4 5 6 7 8 9 | ps -ef |grep pmon > /home/oracle/12.1.0.2_patch_jul2019/current_instance.txt ps -ef |grep tns > /home/oracle/12.1.0.2_patch_jul2019/current_tns.txt cat /etc/oratab > /home/oracle/12.1.0.2_patch_jul2019/current_oratab.txt ==> OS specific $ORACLE_HOME/OPatch/opatch lsinventory > /home/oracle/12.1.0.2_patch_jul2019/before_current_lsinventory.txt tar -cvf oracle_home_19Jul2019.tar $ORACLE_HOME . oraenv export PATH=$ORACLE_HOME/OPatch:$PATH opatch version |
Output of opatch version should be most latest version or similar, refer read me of patch ID document and according that it’s require to upgrade
4. Determine whether any currently installed interim patches conflict with the patch being installed.
1 2 3 4 5 | cd /home/oracle/12.1.0.2_patch_jul2019/29757449 . oraenv export PATH=$ORACLE_HOME/OPatch:$PATH opatch prereq CheckConflictAgainstOHWithDetail -ph ./ |
Make sure no patch conflict output in prerequisite, in case any conflict act according that.
Installation
To install the patch, follow these steps:
1. Set environment
1 2 | . oraenv export PATH=$ORACLE_HOME/OPatch:$PATH |
2. Ensure that you shut down all the services running from the Oracle home where you are performing patch activity. Shutdown DB and Listener running associated from same ORACLE HOME where we are applying patch
For HAS & RAC Instances:
1 2 3 | srvctl status database -d dev12c srvctl stop database -d dev12c srvctl stop listener -listener |
In RAC environment if you don’t have down time then perform instance wise i.e stop services on one node at a time (Rolling fashion)
For Standalone DB:
1 2 3 | sqlplus / as sysdba shutdown immediate lsnrctl stop |
3. Ensure no services / processes are running from target ORACLE HOME
1 2 3 4 | ps -eaf | grep pmon ps -eaf | grep tns ps -eaf | grep exp ps -eaf | grep rman |
4. Set your current directory to the directory where the patch is located and then run the opatch utility by entering the following commands:
1 2 | cd /home/oracle/12.1.0.2_patch_jul2019/29757449 $ opatch apply |
Note: When using opatch you will be asked the following questions for each patch, reply as follows:
Email address/User Name:
Leave Blank
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:
Y
Is the local system ready for patching? [y|n]
y
NOTE: In RAC DB / Instance, it will prompt for next available node to patch after completion on executed node and if you want to instance wise use option –local
6.Verify whether the patch has been successfully installed by running the following command:
1 | opatch lsinventory > /home/oracle/12.1.0.2_patch_jul2019/after_current_lsinventory.txt |
Post patch installation
1. Start the services from the Oracle home.
1 2 3 4 5 | sqlplus /nolog conn / as sysdba startup alter pluggable database all open; ==> optional if Multitenant (CDB/PDB) used quit |
2.
1 2 | cd $ORACLE_HOME/OPatch ./datapatch -verbose |
3. Validate patch applied in database.
1 2 3 4 5 6 7 8 9 10 11 12 | sqlplus / as sysdba SET LINESIZE 400 COLUMN action_time FORMAT A20 COLUMN action FORMAT A10 COLUMN status FORMAT A10 COLUMN description FORMAT A40 COLUMN version FORMAT A10 COLUMN bundle_series FORMAT A10 SELECT TO_CHAR(action_time, 'DD-MON-YYYY HH24:MI:SS') AS action_time, action,status,description, version,patch_id,bundle_series FROM sys.dba_registry_sqlpatch ORDER by action_time; shutdown |
4 Startup database
For HAS / RAC DB / Instance startup:
1 2 | srvctl start database -d dev12c srvctl status database -d dev12c |
For Standalone DB startup:
1 2 3 4 | sqlplus / as sysdba startup ps -eaf | grep pmon ps -eaf | grep tns |
NOTE: Follow post installation step# 1 to 4 for all databases running from same ORACLE_HOME where we applied patch and in RAC environment only execute on one instance.
Make sure all services are up & running from patched ORACLE HOME
Thank you
**This document is only for learning purpose and always validate in LAB environment first before apply on LIVE environment.