All the Views expressed here are my own and do not reflect opinions or views of the anyone else.All the views are tested on my testing environment and kindly test the post before applying anything on production.You can reach to me at neeraj.vishen@gmail.com .

Sunday, July 21, 2013

What are Patches and how to apply patches ?

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 11.2.0.1.0 to Oracle Database 11.2.0.3.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., 11.2.0.1.1 to 11.2.0.1.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.

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

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

Database update.

Here , we will cover the Opatch Utilityin 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 <stage_area>/<patch_id>/etc/config/Inventory .xml file have the following information :

On the patch search section enter patch number and select the platform of your database.

Click search.

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

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

$ tar -zcvf /u01/app/oraInventary/orinv-b4-ptch.tar.gz /u01/app/oraInventary 5.) Apply OPatchesSet 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 ;Notes :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 .There are few good demo on Optach . Check the below link Click HereClick Here

Search This Blog

Translate My Page

About Me

I have started this blog to share my knowledge and experience with other Oracle DBA enthusiasts.I have experience on database architecture ,design and administrating ranging from 9i,10g,11g on various platforms.My main interests are high availability and disaster recovery solutions for mission critical 24×7 systems.