1. Start a Command window with Administrator priviledges
Administrator priviledges are required in order for the OPatch utility to get the appropriate locks on the files that are used by the OPatch utility. To initiate the Command window with Administrative priviledges right-click the icon that you use to start the Command window and select "Run as administrator" from the resulting context menu. This should launch the Command window.
2. Set the ORACLE_HOME environment variable
The ORACLE_HOME environment variable needs to be set within the context of the new Command window. This should be set to the OSB_HOME, typically this
SET ORACLE_HOME=c:\oracle\middleware\Oracle_OSB1
3. Navigate to the directory in which you have unzipped the patch to be applied.
cd PATH_TO_PATCH_DIR
4. Run the OPatch utility to apply the patch.
The OPatch utility can be used to apply the patch with the command:
opatch apply -jdk JDK_HOME
The OPatch utility is available from the OSB_HOME. As we have already set the ORACLE_HOME environment variable to this location we can use this variable to launch the OPatch script. You need to provide the JDK and JRE location. The exact value for JDK and JRE locations will vary depending on the system and installation locations.
%ORACLE_HOME%\OPatch\opatch apply -jdk c:\oracle\middleware\jdk160_24 -jre c:\oracle\middleware\jdk160_24\jre
5. Confirm that the patch has been applied
The OPatch utility can be used to list any patches that have been applied with the following command:
opatch lsinventory
Again, we can use the ORACLE_HOME environment variable to launch the OPatch utility
%ORACLE_HOME%\OPatch\opatch lsinventory
Possible Errors and Solutions
If you have followed the process above then you should not see these errors. They are included here for completeness.
Unable to lock Central Inventory
OiiolLogger.addFileHandler:Error while adding file handler - C:\Program Files (x86)\Oracle\Inventory/logs\OPatch2012-04-23_11-11-28-AM.log
java.io.FileNotFoundException: C:\Program Files (x86)\Oracle\Inventory\logs\OPat
ch2012-04-23_11-11-28-AM.log (Access is denied)
Unable to lock Central Inventory. OPatch will attempt to re-lock.
Do you want to proceed? [y|n]
n
User Responded with: N
Unable to lock Central Inventory. Stop trying per user-request?
OPatchSession cannot load inventory for the given Oracle Home C:\oracle\middlewa
re\Oracle_OSB1. Possible causes are:
No read or write permission to ORACLE_HOME/.patch_storage
Central Inventory is locked by another OUI instance
No read permission to Central Inventory
The lock file exists in ORACLE_HOME/.patch_storage
The Oracle Home does not exist in Central Inventory
ApplySession failed: ApplySession failed to prepare the system. Unable to lock C
entral Inventory. Stop trying per user-request?
System intact, OPatch will not attempt to restore the system
OPatch failed with error code = 73
Solution: Run the command window with Administrator priviledges.
The Oracle Home is not OUI based home
If the ORACLE_HOME environment variable is not set then attempting to run the OPatch utility will result in the error message:
The Oracle Home is not OUI based home. Please give proper Oracle Home.
Solution: Set the ORACLE_HOME to be the OSB_HOME (Oracle_OSB1)