February 04, 2025

Patching: Apply Oracle Database Patch on Linux/Unix host

 How to apply Oracle Database Patches in Linux?

This guide explains how to apply database patches into oracle database and oracle home running on Unix/Linux/ Aix etc.
First, we need to download the required patch from oracle support or metalink. 
Then ftp/scp the patch in a shared path on the server. 

Login to the server:

Setup environment variables.


ORACLE_SID=dev
ORACLE_HOME=/u01/app/oracle
ORACLE_BASE=/u01/app
PATCH_TOP=<Temporary location where the patch is staged>
PATH=$ORACLE_HOME/OPatch:$PATCH_TOP:$PATH:.

Note: Setup the PATH Variable to point to OPatch directory and the Patch directory where the patch is staged.

First update the OPatch binary.
cd $ORACLE_HOME
mv OPatch OPatch.orig
mv $PATCH_TOP/p6880880_19000_<platform>.zip .
unzip p6880880*.zip

This will recreate the OPatch folder to latest version.
Now validate the version with below command:

opatch version

Now unzip the patch in the patch_top location and cd to the patch folder.

opatch lsinventory
cd $PATCH_TOP/<patch_folder>
opatch prereq CheckConflictAgainstOHWithDetail -ph ./

This will check for any conflicts for the patch. If there any conflicts roll it back with the below command:

opatch rollback -id <patch number shown in the conflict check log.>

 Now run opatch apply, and wait for two prompts and select yes both the time.

sqlplus / as sysdba

shut immediate

exit 

opatch apply

It completes the patching, now we need to apply datapatch verbose to update the database registry running on that oracle home. 

sqlplus / as sysdba

startup upgrade

exit

datapatch verbose


This finishes the patching. Now do a full restart of the database.

sqlplus  / as sysdba

shut immediate

startup

exit

lsnrctl start -> to start the listener

Now, test the connectivity and confirm whether the application/ clients are able to connect to the system.


For issues like opatch failed with error 73, please read this article OPatch Error 73

If you find this useful or any error, please leave a comment.

Best Wishes!!

No comments:

Post a Comment

If you have any queries/ any suggestion please do comment and let me know.

Recent Post

Check progress on expdp and impdp

 Check progress on expdp and impdp: In few cases we need to monitor the progress of an export or import job in oracle. below are the steps c...