Blog | Pythian

The getMOSPatch V2 is here!

Written by Maris Elsins | Jul 7, 2016 4:00:00 AM

A while ago I created a Bash script called getMOSPatch.sh. Its purpose was to allow downloading Oracle patches directly from My Oracle Support (MOS) to your server without having to visit the support site (of course, if you know the patch number already). Today, I announce a new version of the tool: "getMOSPatch V2"!

The Evolution of getMOSPatch: From Bash to Java

I received mostly very good feedback about the first version of the script, and it probably saved a few hours I'd spent on the MOS site downloading patches for myself too—i.e., when I was working on a project where 900+ needed to be downloaded.

But there were some issues too, like sensitivity to different versions of the utilities the script uses (curl, wget, egrep), and let's be honest, it worked only on Linux (even though one could have bash on other platforms too).

Why Java? Solving Portability and Dependency Issues

I really wanted to make it less dependent on utilities' versions and wanted it to be more portable, which led me to understanding that there's no future for the bash script. "3 Billion Devices Run Java," so I couldn't do anything else but use Java for the new version of getMOSPatch.

That was actually an easy decision because:

  1. Portability: You can run the tool with good chances on any platform if you have JRE 1.6 or higher.
  2. Integration: JRE is normally bundled with most of Oracle's software (at least the software I work with).

So, Java it was, and that's why the new name goes without ".sh" at the end.

Getting Started: Accessing and Executing the Utility

The new home for getMOSPatch is here on GitHub: https://github.com/MarisElsins/getMOSPatch. The parameters you can use for getMOSPatch are the same as before, but if you need them, you'll find the usage instructions there.

One thing that changed for the new tool is the way it's executed. After downloading the getMOSPatch.jar, you'll use:

  • For JRE 1.7 and later: java -jar getMOSPatch.jar
  • For JRE 1.6: java -Dhttps.protocols=TLSv1 -jar getMOSPatch.jar (because support for TLSv1.1 or TLSv1.2 was not yet added in most 1.6 versions).

Practical Walkthrough: Downloading OPatch on Linux x86-64

Let's take a look at a typical use case of the utility. I'll be using the JRE bundled in the 12c Oracle Home on Linux x86-64 to download the newest version of OPatch:

[oracle@lab12c ~]$ wget "https://github.com/MarisElsins/getMOSPatch/raw/master/getMOSPatch.jar" -q [oracle@lab12c ~]$ . oraenv ORACLE_SID = [LAB12c] ? LAB12c The Oracle base remains unchanged with value /u01/app/oracle [oracle@lab12c ~]$ export PATH=$ORACLE_HOME/jdk/jre/bin:$PATH [oracle@lab12c ~]$ java -version java version "1.6.0_75" Java(TM) SE Runtime Environment (build 1.6.0_75-b13) Java HotSpot(TM) 64-Bit Server VM (build 20.75-b01, mixed mode)  [oracle@lab12c ~]$ java -Dhttps.protocols=TLSv1 -jar getMOSPatch.jar patch=6880880 MOSUser=elsins@pythian.com Enter your MOS password: Platforms and languages need to be reset. Obtaining the list of platforms and languages: ... 46P - Linux x86 226P - Linux x86-64 ... Enter Comma separated platforms to list: 226P We're going to download patches for the following Platforms/Languages: 226P - Linux x86-64  Processing patch 6880880 for Linux x86-64 and applying regexp .* to the filenames: 1 - p6880880_112000_Linux-x86-64.zip 2 - p6880880_121010_Linux-x86-64.zip 3 - p6880880_132000_Generic.zip 4 - p6880880_111000_Linux-x86-64.zip 5 - p6880880_131000_Generic.zip 6 - p6880880_101000_Linux-x86-64.zip 7 - p6880880_102000_Linux-x86-64.zip  Enter Comma separated files to download: 2 Downloading all selected files: Downloading p6880880_121010_Linux-x86-64.zip: 120MB at average speed of 5671KB/s - DONE! 

Cross-Platform Flexibility: Running in Windows PowerShell

And here's another example of this tool running in a Windows PowerShell environment:

Feedback and Continuous Improvement

If you spot any issues or have ideas for improvements, let me know by commenting on this post or submitting the issues directly on GitHub here: https://github.com/MarisElsins/getMOSPatch/issues.

 

Oracle Database Consulting Services

Ready to optimize your Oracle Database for the future?