About Patching in Oracle

Patches are a small collection of files copied over to an existing installation. They are associated with particular versions of Oracle products.
The article is specially for beginners who don’t know about patching, how to apply it, how to get patches, what are the step or process when you need to apply patches  and what are the precaution to be considered while applying patching. Here in this article you will find all those things briefly with an example. For more details please study the oracle documentation.

Types of Patches:

Database patches are various kinds but mainly categories into three parts:

  1. Patchset Exception (also known as PSE, one-off, interim patch)
  2. Patch bundle (also known as MLR patch or Patchset)
  3. Security Patches (also know as CPU and PSU)
  4. Patchset

PSE, one-off or interim patch: This is usually a single fix for single problem. Interim patches are bug fixes given to the customers in critical need and are not cumulative, regressed or versioned. It is applied via opatch. You can use opatch lsinventory command to see which one-off patch are installed on your system.

MRL patch: This type of patch is created by putting several fixes into a single patch. It is also applied using opatch.

Security Patches: Security Patches are mainly divided into two types

  • (i) CPU (Critical Patch Update): These patches are quarterly delivered by oracle to fix security issues.  It is also applied using opatch.
  • (ii) PSU (Patch Set Updates): Patchset updated also quarterly delivered by oracle. It includes CPU and a bunch of other one-off patches. CPU and PSU are Cumulative but we can stop to apply CPU if not required.

Patchset: Patchsets are applied via OUI (Oracle Universal Installer). It is usually applied to upgrade oracle version. For Example if you want to upgrade oracle version from 9.2.0.1.0 to 9.2.0.7.0 then Apply the patchset 4163445. you can find the stepwise details how to Apply patchset on my blog: http://shahiddba.blogspot.com/

About Opatch:

OPatch is a Java-based utility that runs on all supported operating systems and requires installation of the Oracle Universal Installer.

Types of Patches That can not be Used with OPatch

The only type of patch that cannot be used with OPatch is a patchset. A patchset contains a large number of merged patches, is thoroughly tested, changes the version of the product it is applied to, can sometimes introduce new functionality, and should be applied when suitable. Patch sets are cumulative bug fixes that fix all bugs and consume all patches since the last base release. Patchset are usually applied through OUI-based product specific installers.

How to Get Opatch:

  • (i) Access and log into My Oracle Support at the following location: http://support.oracle.com/
  • (ii) In the Search Knowledge Base field, enter 224346.1. This is the ID of the document that describes how to obtain the latest version of OPatch.
  • (iii) In the search results, click on the link corresponding to document ID 224346.1.
  • (iv) In the document, click on the Patch 6880880 link which will take you to the screen where you can obtain the latest version of OPatch based on release versions and platforms.

OPatch System Requirements

The OPatch utility has the following requirements:

  • The ORACLE_HOME environment variable must point to a valid Oracle home directory and match the value used during installation of the Oracle home directory.
  • If the -invPtrLoc command-line argument was used during installation, and then it must be used when using the OPatch utility. Oracle recommends the use of the default central inventory for a platform.
  • The java, ar, cp, and make commands must be available in one of the directories listed in the PATH environment variable. The commands are not available for all platforms.

Getting Patches:

  • (i) Access and log into My Oracle Support at the following location: http://support.oracle.com/
  • (ii) Click the Patches & Updates link.
  • (iii) Enter the Patch ID or Number, then click Search. A Patch Search Results table appears.
  • (iv) Using the Release and Platform columns, find the desired patch, then click the associated Patch ID.
  • (v) In the page that now appears, click the Download button in the right-hand column.

Backup and Recovery Considerations for Patching

It is highly recommended that you back up the ORACLE_HOME before any patch operation. You can back up the ORACLE_HOME using your preferred method. You can use any method such as zip, cp -r, tar, and cpio to compress the ORACLE_HOME.

Steps and Process when you need to apply patches:

First, determine the patch you have to apply, if you are applying a patchset (e.g., 10.2.0.1 to 10.2.0.3) or a one-off patch or CPU patch. These are applied in different ways. Applying a patchset usually requires the use of the Oracle Universal Installer (OUI) and then running a script inside each database using that ORACLE_HOME. When you download the patchset, it will be accompanied by a detailed, step-by-step guide for how to apply the patchset.
Step 1: Contact Oracle Support

You can contact to the oracle support representative and you can go to the MY Oracle Support: https://support.oracle.com/CSP/ui/flash.html

Step 2: Check for Existing patches

If Oracle Support is not able to resolve the issue, they may ask to see if you have any patches already installed on your system. To determine this information, you should run the opatch lsinventory command or opatch checkInstalledOneOffs command.
Example:
D:>cd %ORACLE_HOME%opatch
D:oracleora92OPatch>opatch lsinventory
Note: Opatch does not list the patch applied on Database. It list only the interim patch applied on oracle binaries. You can list patch applied on database with the help of below query in 10g R2.
SQL>Select * from sys.registry$history;

Step 3. Obtain OPatch and the Necessary Patch

Upon determining that you are in need of a new patch and it has not already been installed on your system, you should do the above steps: Getting Patches:

Step 4. Determine the Oracle Home

Once you obtain the patch, determine the Oracle home directory to which you are going to apply the patch.

Step 5. Read the README File

Read the README file that accompanies the patch. This file contains important information and instructions that must be followed prior to applying your patch.

Step 6. Apply the Patch

After you determine the Oracle home to which you need to apply the patch, you should apply the patch with the opatch apply command

The syntax for the apply command is shown below:

opatch apply    [-auto [-domain domain_name]]    [-mw_home MW_HOME]    [-oh ORACLE_HOME]    [-property_file path_to_property_file]    [-report]]

After Applying the Patch…

In most cases, after you apply the patch the instructions in the README file will tell you to run the opatch start command to re-start your servers.

After the patching is complete and your servers are restarted, you should check your product software to verify that the issue has been resolved.

If for some reason the result is not satisfactory, you can use the opatch rollback command to remove the patch from the Oracle home.

The syntax for the rollback option is shown below:

opatch rollback -id patch_id    [-auto [-domain domain_name]]    [-mw_home MW_HOME]    [-oh ORACLE_HOME]    [-property_file path_to_property_file    [-report]]

How to apply Patchset updates or Critical Patch Updates with Example

PSUs (PatchSet Updates) or CPUs(Critical Patch Updates) are applied via Opatch utility.
Opatch is an interim utility for applying Database interim patches which will fix the bug in the release. For making use of the opatch utility you have to download the opatch recent version and apply as follow:
Opatch is very useful for applying the database patches to fix various bugs and it is essential to have the latest version.
1) Download the latest OPatch version from My Oracle Support.
a) Click on the “Patches & Updates” tab
b) In the “Patch Name or Number” field type 6880880
c) In the “Platform” field select the relevant platform
d) Click the Search button.
e) Select the patch that corresponds to the Oracle release installed:
6880880 Universal Installer: Patch OPatch 11.2
f) Click the Download button
Once the above task is done copy the patch to $ORACLE_HOME directory and move the previous OPatch directory to separate directory in OS. We can use winscp or ftp for copying this patch from MOS to windows and than windows to linux Box.
g) Now, unzip this patch zip file and apply it.

How to apply patch:

C: CD oracle1Opatch      — “C:ORACLE1” is the ORACLE-HOME
C:oracle1Optachopatch> apply D:Patch_dir   — “D:Patch_dir” is the path where you have downloaded or kept the patch.
Note: Before going to apply the patch you must search or check these file Users_Guide.txt, opatch_history.txt.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s