The getMOSPatch V2 Is Here!

Posted in: DBA Lounge, Oracle, Technical Track

A while ago I created a Bash script called getMOSPatch.sh. It’s purpose was to allow downloading Oracle patches directly from My Oracle Support 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”!

I received mostly very good feedback about the first version of the script, and it probably saved few hours I’d spent on 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). So, I really wanted to make it less dependent on utilities’ versions and wanted it to be more portable, which lead 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 the getMOSPatch. That was actually an easy decision, because 1) I needed portability, and now you can run the tool with good chances on any platform if you have JRE 1.6 or higher, and 2) JRE is normally bundled with most of Oracle’ software (at least software I work with). So, java it was, and that’s why the new name goes without “.sh” at the end.

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 you’ll find the usage instructions here.
One thing that changed for the new tool is the way how it’s executed. After downloading the getMOSPatch.jar you’ll use “java -jar getMOSPatch.jar” for JRE 1.7 and later, or “java -Dhttps.protocols=TLSv1 -jar getMOSPatch.jar” for most versions of JRE 1.6 (because the support for TLSv1.1 or TLSv1.2 was not added yet).

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!

And here’s another example of this tool running in Windows Powershell environmnet:

getMOSPatch on Windows

getMOSPatch on Windows

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

email

Interested in working with Maris? Schedule a tech call.

About the Author

Maris Elsins is an experienced Oracle Applications DBA currently working as Lead Database Consultant at The Pythian Group. His main areas of expertise are troubleshooting and performance tuning of Oracle Database and e-Business Suite systems. He is a blogger and a frequent speaker at Oracle related conferences such as UKOUG, Collaborate, Oracle OpenWorld, HotSos, and others. Maris is an Oracle ACE, an Oracle Certified Master, and a co-author of “Practical Oracle Database Appliance” (Apress, 2014). He's also a member of the board at Latvian Oracle User Group.

4 Comments. Leave new

Andrey Chervonets
July 10, 2016 12:47 am

bash / bat wrapper script would be helpfull anyway – to detect version of java and use proper parameters calling java.
It is not problem to remember (and keep in text file) all that parameters “java -Dhttps.protocols=TLSv1 -jar…” but having it all incapsulated in bash/bat script will save some more seconds per download.

Reply

Hello Maris- First of all, Thank you for spending time on this. Its really useful. But i keep getting these two errors and am never successful in download all patches.

1. java.net.UnknownHostException: login.oracle.com
2. java.net.UnknownHostException: aru-akam.oracle.com

These two are intermittent exceptions. I would understand if its permanent issue due to internet connectivity or firewall issues.

Reply

Hi Ravi,

You have mentioned that these errors are intermittent but at the same time you have never been able to download the patches. I still think this is something network related on the server you’re running this from.

Could you try some things like:
nslookup login.oracle.com
nslookup aru-akam.oracle.com
telnet login.oracle.com 443
telnet aru-akam.oracle.com 443

Just to check that you really can reach these servers?
The error message “UnknownHostException” is self-explanatory – the IP address of the hosts can’t be determined, which is most likely due to configuration of the server/network/firewalls/etc.
Maris

Reply

If there are 10 files in a patch, with download=yes, it downloads 1st one and fail with unknownhost aru-akam.oracle.com exception. this is what i meant by never been able to download all patches.

sometimes, it fails to login with unknowhost login.oracle.com exception.

You are right. The errors must be from the networking issue. I will check it out. Thanks.

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *