Every DBA has been there. You “just” want to apply a PSU, one-off patch or mostly anything in Oracle and quickly browse through the release notes or Readme when you encounter this:
You must use the OPatch utility version 188.8.131.52.1 or later to apply this patch. Oracle recommends that you use the latest released OPatch version for 12.1, which is available for download from My Oracle Support patch 6880880 by selecting the 184.108.40.206.0 release.
Almost every patch requires you to patch OPatch first. Which really is not a big deal: download patch 6880880, move the old $ORACLE_HOME/OPatch out of the way (or back up) and unzip the new one in it’s place. A very boring task, especially of you maintain a number of Homes on a box or multiple database servers. I am tired of performing these tasks and came up with this:
- build a simple rpm package that holds OPatch
- put this in our (private) repository so yum will pull and update it
- install to /opt/OPatch and symlink from Oracle Homes
That way all I have to do for new OPatch versions is to build a new rpm, run a yum upgrade on the server and I am done.
Here is how to simply build such an rpm with an awesome little tool called fpm (Effing Package Management):
cd /tmp unzip p6880880.zip fpm -a all -d "oracle-rdbms-server-12cR1-preinstall" -s dir -t rpm --rpm-sign -m "portrix Systems GmbH
" --url "https://support.oracle.com" --vendor "Oracle America, Inc." --description "OPatch patch Oracle software" --after-install <(echo "chown -R oracle:oinstall /opt/OPatch") --name opatch-12c -v 220.127.116.11.2 --iteration 1.el6 /tmp/OPatch=/opt/
You can leave out the --rpm-sign if you do not have it set up. And if you are using RedHat instead of Oracle Linux and do not have or use the preinstall-rpm, you have to leave out the reference to the dependancy (-d "oracle-rdbms-server-12cR1-preinstall").