OPatch is a utility that allows you to apply and/or roll back interim patches to Oracle's software. The manual process of applying a patch is called binary patching. For binary patching, you can use the OPatch utility to:
Always refer to the patch README for any special instructions before you apply a patch.
Oracle recommends 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
You should use the version of OPatch that supports the ORACLE_HOME release. For example, if you are patching a 12.0.1 Oracle Home, then use OPatch version 12.0.1. If the Oracle Home is version 11.2 , then use OPatch version 11.2.
Oracle recommends that you use the latest released OPatch for 12.1 releases, which is available for download from My Oracle Support (patch 6880880). Select the ARU link for the 220.127.116.11.0 release.
You can also view the support document "OPatch - Where Can I Find the Latest Version of OPatch?" (Doc ID 224346.1). This document contains a link to the instructional video "Downloading the OPatch Tool from MOS."
Before you use the OPatch command and available options, you must check that OPatch prerequisites have been fulfilled.
Using the OPatch utility to patch your product (e.g., Fusion Middleware) home typically consists of the following steps:
OPatch verifies whether the product home is present. You must ensure that the
ORACLE_HOME environment variable is set to the product home of the product you are trying to patch. Check your respective vendor documentation for the details on how to set the environment variable.
Oracle Universal Installer binaries and inventories must be present in the home to be patched.
Other environment variables used include:
OPATCH_DEBUG — Boolean setting that enables additional debugging information that can be used by software developers.
PATH — Product home path information.
Adding $ORACLE_HOME/OPatch to the $PATH makes it more convenient to execute the OPatch commands from any directory.
The next step is to determine what is already installed on your system. For this, you use the
lsinventory command with either the
For more information about this command, see "lsinventory."
After you have determined that your system configuration is appropriate for the patches you wish to apply, it is advisable to view the operations OPatch will perform before performing the patch application to help determine whether all system prerequisites are met before applying the patch. For this, you use the OPatch
-report option to print all patch application actions OPatch will perform without actually executing the actions.
opatch apply -report
For more information about the -report option, see "OPatch Syntax and Commands."
Once you have determined that the patch can be applied to your system successfully, you can now use OPatch to apply the patch. For this, you use the OPatch
opatch apply /tmp/patch/12345678
For more information about this command, see"apply."
After you have applied the patch to your system, you should perform a final check to ensure all patches have been successfully applied. For this, you again use the OPatch
lsinventory command with either the
patch_id options. For more information about this OPatch command, see "lsinventory."
Once you have verified the prerequisite checks, use OPatch to apply a patch:
The OPatch utility is located in the
$Oracle_Home/OPatch directory. You can run it with various commands and options. See OPatch Syntax and Commands, for a complete list of command options available with OPatch.
You apply a single patch following the generic patching workflow discussed earlier:
Once you have downloaded the patch, you can apply it (step 5) using the following command:
# opatch apply <patch directory location>/<patch ID>
# opatch apply /tmp/patch/12345678
You can create a text file containing the location of all patches you need to apply. Use OPatch to reference the file and apply the patches:
Create the text file of the patch location. The entry should have each patch location on a separate line:
vi patches.txt /tmp/patchlocation1/12345678 /tmp/patchlocation2/12365478 /scratch/patchlocation3/32165487
Save your changes.
Apply the patches with OPatch:
# opatch napply - -phBaseFile <location of text file>
#opatch napply - -phBaseFile /tmp/patches/patches.txt
OPatch detects and reports any conflicts encountered when applying a patch with a previously applied patch. The patch application fails in case of conflicts. You can use the
-force option of OPatch to override this failure. If you specify
-force, the installer firsts rolls back any conflicting patches and then proceeds with the installation of the desired patch. Using -force means that you will likely lose some bug fixes, that are causing the conflict, in exchange for getting the incoming patch to be applied.
You may experience a bug conflict and might want to remove the conflicting patch. This process is known as patch rollback. During patch installation, OPatch saves copies of all the files that were replaced by the new patch before the new versions of these files are loaded, and stores them in
$ORACLE_HOME/.patch_storage. These saved files are called rollback files and are key to making patch rollback possible. When you roll back a patch, these rollback files are restored to the system. If you have a complete understanding of the patch rollback process, you should only override the default behavior by using the
-force flag. To roll back a patch, execute the following command:
$ OPatch/opatch rollback -id <Patch_ID>
A patch conflict occurs when multiple fixes in different patches touch the same files but have not been tested together as a single entity. OPatch and OPatchAuto help you avoid these conflicts by identifying these conditions. When patch conflicts occur and you are unable to resolve them using documented support procedures, MOS then becomes the go-to source for technical assistance. Conflict resolution may entail filing a Service Request and obtaining a Merge Label Request (MLR) patch to overcome a patching issue. Once a solution has been found, you use OPatch to apply the fixed patch.