OPatch is a Java-based utility used to apply patches to Oracle software. It runs on all supported operating systems and requires installation of the Oracle Universal Installer.
Patches are a small collection of files copied over to an existing installation. They are associated with particular versions of Oracle products. When applied to the correct version of an installed product, patches result in an upgraded version of the product.
When applying patches using OPatch, it is highly recommended that you use the latest version of OPatch, which can be downloaded from by searching for patch number 6880880 in Patches & Updates after logging on to MOS. Make sure you download the OPatch, which is relevant to your operating system.
Once you’ve downloaded the latest version of OPatch from MOS, you should extract the zip version and replace the entire OPatch folder, which is in your Oracle Home with this new version. Common location of OPatch is something like this C:\Oracle\product\11.2.0\dbhome_1\OPatch
Before you run OPatch, ensure that you set the ORACLE_HOME environment variable. OPatch uses the ORACLE_HOME environment variable to identify the Oracle home you are planning to patch.
Location of OPatch:
OPatch can be found in the following location after you install any Oracle Fusion Middleware product – ORACLE_HOME/OPatch
To run OPatch, you need to simply run the opatch command in this directory.
Commonly used OPatch commands:
- OPatch version
- OPatch lsinventory
- OPatch lsinventory -detail
- OPatch apply
- OPatch rollback
- OPatch query
Commonly used OPatch environment variables:
- ORACLE_HOME – This is the Oracle home location.
- PATH – This is the path information.
- OPATCH_DEBUG – This is the log level that specifies the amount of logging OPatch should perform.
- OPATCH_PLATFORM_ID – This is the unique platform ID.
Logging and Tracing with OPatch
OPatch maintains logs for all apply, rollback, and lsInventory operations. The log files are located in <ORACLE_HOME>/cfgtoollogs/opatch directory. Each log file will be tagged with the timestamp of the operation. Log files are named as opatch_<date mm-dd-yyyy>_<time hh-mm-ss>.log. Each time OPatch is executed a new log file is created.
You can set OPatch debug mode by setting the environment variable OPATCH_DEBUG to TRUE.
OPatch also maintains an index of the commands executed with OPatch and the log files associated with it in the history.txt file located in <ORACLE_HOME>/cfgtoollogs/opatch directory.
You can set the log level by using the -logLevel <level> option available. OPatch supports the following log levels: