Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Saturday, 21 April 2012

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:\oracle\ora92\OPatch>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 oracle1\Opatch      -- “C:\ORACLE1” is the ORACLE-HOME
C:\oracle1\Optach\opatch> 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.
For Example:
To Apply patches on 9.2.0.1.0 to upgrade 9.2.0.7.0 check the below link: http://shahiddba.blogspot.com/2012/03/upgrade-database-version-fron-92010-to.html
Applying a patch releaseOracle® Database 2 Day DBA 10g Release 2 (10.2)
http://docs.oracle.com/cd/B16341_01/doc/server.102/b14196/software002.htm

12 comments:

  1. Nice work, May ALLAH reward you for sharing knowledge. Ameen

    ReplyDelete
  2. Its very useful and nice topic..thanks

    ReplyDelete
  3. Hi shahid ;

    Well. I searched via Google related to types of patches. Really i am helpless.
    I found finally some information's here . thanks shahid.
    I need just definition and some information about patchbundle vs Patchsets?

    In your posting also you mentioned "Types of patches"

    2. Patch bundle (also known as MLR patch or Patchset)
    4. Patchset -> why did you separately thisone ?

    Thanks . Please clarify ..

    ReplyDelete
    Replies
    1. Dear,

      Patchset are usually applied to change the version with different new functionality.
      you can download it from metalink in a single download file.
      where as bundle patchses in terms of bundle instead of separate file which include
      both the quarterly security patches as well as recommended fixes for Windows and Exadata. When
      you try to download these patch you can find different set of file.
      Refer the metalink for details bundle patches: [ID 756671.1], Oracle Products [ID 1430923.1]

      Delete
    2. Thanks Shahid ..

      Delete
  4. Hello Shahid;

    IS this True ? - I am getting confused. Please answer for following questions.

    1. Opatch (utility)is also another type of patch.
    2. When we applying single patch , we can use opatch utility.
    3. When we applying patchsets , we can use OUI.
    4. If we have downtime , we can use OUI. If not we can use opatch.

    Thanks shahid ..

    ReplyDelete
    Replies
    1. Dear,

      Based on my experience and knowledge the answer is based on. For more details it is better to follow the oracle documentation or discuss other experts.

      1. Opatch (utility)is also another type of patch.
      OPatch is utility from oracle corp. (Java based utility) that helps you in applying interim patches to Oracle's software and rolling back interim patches from Oracle's software. Opatch also able to Report already installed interim patch and can detect confilict when already interim patch has been applied. This program requires Java to be vailable on your system and
      requires installation of OUI. Thus from the above discussion coming to your question it is not ideal to say it it is another patch.

      2. When we applying single patch , we can use opatch utility.
      Yes, you can use Optach incase of single patch. The only type of patch that cannot be used with OPatch is a patchset

      3. When we applying patchsets , we can use OUI.
      Yes, Patcheset uses OUI. A patch set contains a large number of merged patches, to change the version of the product or
      introduce new functionality. Patch sets are cumulative bug fixes that fix all bugs and consume all patches since the last base release. Patch sets and the Patch Set Assistant are usually applied through OUI-based product specific installers.

      4. If we have downtime , we can use OUI. If not we can use opatch. As you know for apply patch your database and listener must be down. When you apply OPTACH it will update your current ORACLE_HOME. coming to your question to the point infact it is not possible in case of single instance but in RAC you can Apply Optach without downtime as there there will be more separate ORACLE_HOME and more seperate instances running once instance on each ORACLE_HOME

      Delete
  5. Well Shahid. Good to understand. Many Many Thanks to you

    ReplyDelete
  6. Hi shahid;

    Ques 1 :
    NApply -> Will apply all patches to RDBMS home.
    I need only one patch to apply ORACLE_HOME.
    Suppose i have collection of patches - (nearly 100 patches) as "patchsets" ..
    How can i apply specific patch when extracting all patches from patchsets or patch bundles ?

    Ques 2 :
    $ opatch lsinventory command i know it.
    How can i get a minimum information from inventory about patches applied and components installed ?
    How can i get a detailed information from inventory about patches applied and components installed. ?

    Ques3 :
    When applying patch or patchsets what are the changes happening in central_inventory , and local_inventory ?

    Ques 4:
    When applying cpu or psu patch (bug fixes) - What kind of errors usually resolved ?
    When applying CPU ... ?
    When applying PSU ... ?

    >> Sorry for asking too many Questions .. In future , It will help many Oracle folks (Beginners) to understand.

    ReplyDelete
    Replies
    1. With Napply by providing patch location and specific id you can apply only one patch ‎from a collection of extracted patch. For more information check the opatch util NApply ‎‎–help. It will give you clear picture.‎
      Try this command for Minimum and detail information from inventory
      C:\ORACLE_HOME\Opatch\opatch lsinventory –invPtrLoc “location of ‎oraInst.loc file”‎
      ‎$ORACLE_HOME\Opatch\opatch lsinventory -detail -invPtrLoc “location of ‎oraInst.loc file”‎
      Critical Patch update (CPU) patches were the original quarterly patches that were ‎released by oracle to target the specific security fixes or issues in various products. ‎Consider it as a subset of patchset updates (PSU). CPU are built on the base patchset ‎version where as PSU are built on the base of previous PSU.‎
      Patch Set Updates (PSUs): patches which are also released quarterly along with CPU ‎patches are a superset of CPU patches in the term that PSU patch will include CPU ‎patches and some other bug fixes released by oracle. One thing to remind you here once ‎you apply the PSU then the recommended way is to apply the next PSU. In fact, no need ‎to apply CPU on the top of PSU as PSU contain CPU (If you apply CPU over PSU will ‎considered you are trying to rollback the PSU and will require more effort in fact).‎
      So if you have not decided or applied any of the patches then, I will suggest you to go to ‎use PSU patches. For more details refer: Oracle Products [ID 1430923.1], ID 1446582.1‎
      PSU deal the fixes like Wrong results, Data corruption etc.

      Delete
  7. HI Shahid,
    I am recently assigned to DB patching project.my envirnment is Single instance in ASM. i am doing fine in 8i to 11gR1. but i am failing in 11gR2. can you please give me check list and step by step process in 11gR2 ASM Patching(11.2.0.2---11.2.0.3). we are using "has" in ASM. looking forward to hear from you........avreddy666@gmail.com

    ReplyDelete
  8. and we are using silent installation....

    ReplyDelete