The getMOSPatch V2 is here!

Posted in: DBA Lounge, Oracle, Technical Track

A while ago I created a Bash script called 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:
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 "" -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
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 –
 2 –
 3 –
 4 –
 5 –
 6 –
 7 –
 Enter Comma separated files to download: 2
Downloading all selected files:
 Downloading 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:


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.

8 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.


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.


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


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:
telnet 443
telnet 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.


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

sometimes, it fails to login with unknowhost exception.

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


Hello Maris,

Looks like Oracle has changed something. please see below;

java -jar getMOSPatch.jar patch=30733704

Platforms and languages need to be reset.
Obtaining the list of platforms and languages:

Enter Comma separated platforms to list: 226P
ERROR: Unparsable inputs. Try Again.

Maris Elsins
May 12, 2020 1:06 pm


Thanks for letting me know!
I was reported this already yesterday.
I’ll be looking into solving that soon,
meanwhile, you should still be able to use the old shell script version –


Maris Elsins
May 12, 2020 4:39 pm

This should be resolved in the version I just uploaded to github.


Thank you!


Leave a Reply

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