Patching is one of the most common task performed by DBA’s in day-to-day life . Here , we will discuss about the various types of patches which are provided by Oracle . Oracle issues product fixes for its software called patches. When we apply the patch to our Oracle software installation, it updates the executable files, libraries, and object files in the software home directory . The patch application can also update configuration files and Oracle-supplied SQL schemas . Patches are applied by using OPatch, a utility supplied by Oracle , OUI or Enterprise Manager Grid Control .
Oracle Patches are of various kinds . Here , we are broadly categorizing it into two groups .
1.) Patchset :
2.) Patchset Updates :
1.) Patchset : A group of patches form a patch set. Patchsets are applied by invoking OUI (Oracle Universal Installer) . Patchsets are generally applied for Upgradation purpose . This results in a version change for our Oracle software, for example, from Oracle Database 22.214.171.124.0 to Oracle Database 126.96.36.199.0. We will cover this issue later .
2.) Patchset Updates : Patch Set Updates are proactive cumulative patches containing recommended bug fixes that are released on a regular and predictable schedule . Oracle has catergaries as :
i.) Critical Patch Update (CPU) now refers to the overall release of security fixes each quarter rather than the cumulative database security patch for the quarter. Think of the CPU as the overarching quarterly release and not as a single patch .
ii.) Patch Set Updates (PSU) are the same cumulative patches that include both the security fixes and priority fixes. The key with PSUs is they are minor version upgrades (e.g., 188.8.131.52.1 to 184.108.40.206.2). Once a PSU is applied, only PSUs can be applied in future quarters until the database is upgraded to a new base version.
iii.) Security Patch Update (SPU) terminology is introduced in the October 2012 Critical Patch Update as the term for the quarterly security patch. SPU patches are the same as previous CPU patches, just a new name . For the database, SPUs can not be applied once PSUs have been applied until the database is upgraded to a new base version.
iv.) Bundle Patches are the quarterly patches for Windows and Exadata which include both the quarterly security patches as well as recommended fixes.
PSUs(PatchSet Updates) or CPUs(Critical Patch Updates) ,SPU are applied via opatch utility.
How to get Oracle Patches :
We obtain patches and patch sets from My Oracle Support (MOS) . The ability to download a specific patch is based on the contracts associated to the support identifiers in our My Oracle Support account. All MOS users are able to search for and view all patches, but we will be prevented from downloading certain types of patches based on our contracts.
While applying Patchset or patchset upgrades , basically there are two entities in the Oracle Database environment
i. ) Oracle Database Software
ii.) Oracle Database
Most of the database patching activities involve, in the following sequence
Update “Oracle Database Software” using ‘./runInstaller’ or ‘opatch apply’ known as “Installation” Tasks.
Update “Oracle Database” (catupgrd.sql or catbundle.sql …etc) to make it compatible for newly patched “Oracle database Software” known as “Post Installation” tasks.
Patchset OR CPU/PSU (or one-off) patch contains Post Installation tasks to be executed on all Oracle Database instances after completing the Installation tasks. If we are planning to apply a patchset along with required one-off-patches (either CPU or PSU or any other one-off patch), then we can complete the Installation tasks of the Patchset+CPU/PSU/one-off patches at once and then execute Post Installation tasks of the Patchset+CPU/PSU/one-off patches in the same sequence as they were installed .
This approach minimizes the requirement of database shutdown across each patching activity and simplifies the patching mechanism as two tasks:
Software update and then
Here , we will cover the Opatch Utility in details along with example.
OPatch is the recommended (Oracle-supplied) tool that customers are supposed to use in order to apply or rollback patches. OPatch is PLATFORM specific . Release is based on Oracle Universal Installer version . OPatch resides in $ORACLE_HOME/OPatch . OPatch supports the following :
Applying an interim patch.
Rolling back the application of an interim patch.
Detecting conflict when applying an interim patch after previous interim patches have been applied. It also suggests the best options to resolve a conflict .
Reporting on installed products and interim patch.
The patch metadata exist in the inventory.xml and action.xml files exists under //etc/config/
Inventory .xml file have the following information :
Unique Patch ID
Date of patch year
Required and Optional components
OS platforms ID
Instance shutdown is required or not
Patch can be applied online or not
Actions .xml file have the following information .
File name and it location to which it need to be copied
Components need to be re-linked
Information about the optional and required components
Here are steps for applying patches on linux Platform :
1.) Download the required Patches from My Oracle Support (MOS) :
Login to metalink.
Click “Patches & Updates” link on top menu.
On the patch search section enter patch number and select the platform of your database.
On the search results page, download the zip file.
2.) Opatch version :
Oracle recommends that we use the latest released OPatch , which is available for download from My Oracle Support . OPatch is compatible only with the version of Oracle Universal Installer that is installed in the Oracle home. We can get all Opatch command by using Opatch help command .
3.) Stop all the Oracle services :
Before applying Optach , make sure all the Oracle services are down . If they are not down then stop/down the oracle related Services . Let’s crosscheck it
$ ps -ef |grep pmon
oracle 15871 15484 0 11:20 pts/2 00:00:00 grep pmon
$ ps -ef |grep tns
oracle 15874 15484 0 11:20 pts/2 00:00:00 grep tns
4.) Take Cold Backup :
It is highly recommended to backup the software directory which we are patching before performing any patch operation . This applies to Oracle Database or Oracle Grid Infrastructure software installation directories. Take the backup of following
Take the Oracle software directory backup
$ tar -zcvf /u01/app/oracle/product/11.2.0/ohsw-bkp-b4-ptch.tar.gz /u01/app/oracle/product/11.2.0
Take backup of oracle database .
$ tar -zcvf /u01/app/oracle/oradata/dbfl-b4-ptch.tar.gz /u01/app/oracle/oradata
Here all the database files are in oradata directory .
Take backup of OraInventary
$ tar -zcvf /u01/app/oraInventary/orinv-b4-ptch.tar.gz /u01/app/oraInventary
5.) Apply OPatches
Set our current directory to the directory where the patch is located and then run the OPatch utility by entering the following commands:
$ export PATH=$ORACLE_HOME/OPatch:$PATH:
$ opatch apply .
6.) Post Installation :
Once , the Opatch installation completed successfully . Perform the post Installation steps . Startup the oracle database with new patched software and run catbundle.sql scripts which is found in $ORACLE_HOME/rdbms/admin directory .
The catbundle.sql execution is reflected in the dba_registry_history view by a row associated with bundle series PSU.
7.) Finally check the status of patch status :
We can check the final status of applied patched new Oracle Home by using the below command .
SQL > select * from dba_registry_history order by action_time desc ;
i.) If we are using a Data Guard Physical Standby database, we must install this patch on both the primary database and the physical standby database .
ii.) While applying patching take care of mount point status .There should be sufficient Space .
Enjoy 🙂 🙂