Monday, March 16, 2015

OPatch Utility and Commands


The OPatch utility is a tool that allows the application and rollback of interim patches to Oracle products. This section provides information on how to use OPatch to apply patches and various option that can be used along with it.

OPatch Utility Basic Syntax:
The OPatch utility is located in the <Path_to_Oracle_Home>/OPatch directory. You can run it with various commands and options. The following command shows the syntax for the OPatch utility:  <Path_to_OPatch>/opatch <command> [-options]

apply Command:
The apply command applies an interim patch to a specified Oracle home. The ORACLE_HOME environment variable must be set to the Oracle home to be patched. Use following syntax for this command: <Path_to_OPatch>/opatch apply

  Example : 
  •   Navigate to the directory where patch copied => <Path_to_OPatch>/opatch
  •   Set the ORACLE_HOME to the {oracle_home} (Run "export ORACLE_HOME={fmwproduct_home}")
  •   Validate the Oracle_home to make sure it is set correctly (echo $ORACLE_HOME)
  •   Run "opatch apply"

lsinventory Command:
The lsinventory command reports what has been installed on the system for a particular Oracle home directory, or for all installations. The following syntax is used for this command: <Path_to_OPatch>/opatch lsinventory [-all] [-bugs_fixed asc|desc] [-delay (value)] [-detail] [-invPrtLoc (path)] \ [-jre (location)] [-patch asc|desc] [-oh (Oracle Home location)] [-retry (value)]
  
Example:
  •         Navigate to the directory where patch copied => <Path_to_OPatch>/opatch
  •         Set the ORACLE_HOME to the {oracle_home} (Run "export ORACLE_HOME={fmwproduct_home}")
  •         Validate the Oracle_home to make sure it is set correctly (echo $ORACLE_HOME)
  •         Run "opatch lsinventory"

rollback Command:
The rollback command removes a specific interim patch from the appropriate Oracle home directory. The following syntax is used for this command: <Path_to_OPatch>/opatch rollback -id

Example:
  •   Navigate to the directory where patch copied => <Path_to_OPatch>/opatch
  • Set the ORACLE_HOME to the {oracle_home} (Run "export ORACLE_HOME={fmwproduct_home}")
  • Validate the Oracle_home to make sure it is set correctly (echo $ORACLE_HOME)
  • un "opatch rollback -id"

napply Command:
This command applies interim patches to several Oracle homes at the same time.

Example
  • The following example applies all patches under the <patch_location> directory: 
  • opatch napply   <patch_location>
  • The following example applies patches 1, 2, and 3 that are under the <patch_location> directory:
  • opatch napply <patch_location> -id 1,2,3

version Command:
The version command shows the current version number of the OPatch utility.
The following syntax is used for this command:  <Path_to_OPatch>/opatch version 

No comments:

Post a Comment