Thursday, 30 August 2012

OPatch Wrapper

Now we have our environment set up properly we can look at streamlining processes. Such as patching.

Patching with OPatch is already pretty easy. But we can easily make it easier.

For this to work you have to have all your patches reside under in folders under a shared drive. You should already.

call setEnv.bat > NUL

SET PATCHPATH=N:\Patches_Q3_2012
echo "Patch directory = %PATCHPATH%"

md %EPM_ORACLE_HOME%\OPatch\%1
echo "Creating patch directory %EPM_ORACLE_HOME%\OPatch\%1"

echo "Copying patch files from %PATCHPATH%\%1 to %EPM_ORACLE_HOME%\OPatch\%1"
xcopy /E /D /Y %PATCHPATH%\%1\*.* %EPM_ORACLE_HOME%\OPatch\%1

echo "Applying patch %1"
cd /d %EPM_ORACLE_HOME%\OPatch
opatch apply %EPM_ORACLE_HOME%\OPatch\%1 -oh %EPM_ORACLE_HOME% -jre %JRE_HOME%

echo "Patch process complete!"

You need to change the PATCHPATH variable to suit your environment. You call the script like so:

apply_patch.bat 13904628

And then the patch 13904628 will be copied from the shared drive to the server and OPatch invoked. There is no error-checking but for now it is a decent way to slightly speed up the patching process.

You can download the script here.

No comments:

Post a Comment