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:
[[email protected] ~]$ wget "https://github.com/MarisElsins/getMOSPatch/raw/master/getMOSPatch.jar" -q [[email protected] ~]$ . oraenv ORACLE_SID = [LAB12c] ? LAB12c The Oracle base remains unchanged with value /u01/app/oracle [[email protected] ~]$ export PATH=$ORACLE_HOME/jdk/jre/bin:$PATH [[email protected] ~]$ 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) [[email protected] ~]$ java -Dhttps.protocols=TLSv1 -jar getMOSPatch.jar patch=6880880 [email protected] 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:
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
10 Comments. Leave new
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.
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.
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
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.
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.
Ravi,
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 – https://github.com/MarisElsins/TOOLS/blob/master/Shell/getMOSPatch.sh
Maris
This should be resolved in the version I just uploaded to github.
Thank you!
Hello Maris,
I tried database patch 29997959 and it listed 6 patches but did not list hte patch for version 12.1.0.2, the patch file is p29997959_121020_Generic.zip.
Processing patch 29997959 for Linux x86-64 and applying regexp .* to the filenames:
1 – p29997959_189000OJVMRU_Generic.zip
2 – p29997959_12201191015OJVMRU_Generic.zip
3 – p29997959_190000_Generic.zip
4 – p29997959_188000OJVMRU_Generic.zip
5 – p29997959_122010_Generic.zip
6 – p29997959_180000_Generic.zip
any idea why?
Hi,
not sure, this is the list I’m getting.
$ java -jar getMOSPatch.jar patch=29997959 platform=226P
...
We're going to download patches for the following Platforms/Languages:
226P - Platform 226P
Processing patch 29997959 for Platform 226P and applying regexp .* to the filenames:
1 - p29997959_189000OJVMRU_Generic.zip
2 - p29997959_12102191015OJVMDatabase_Generic.zip
3 - p29997959_12201191015OJVMRU_Generic.zip
4 - p29997959_121020_Generic.zip
5 - p29997959_112040_Linux-x86-64.zip
6 - p29997959_190000_Generic.zip
7 - p29997959_188000OJVMRU_Generic.zip
8 - p29997959_122010_Generic.zip
9 - p29997959_12102171017OJVMDatabase_Linux-x86-64.zip
10 - p29997959_12102190115OJVMDatabase_Linux-x86-64.zip
11 - p29997959_180000_Generic.zip
Enter Comma separated files to download ("all" or "none" can be used too):
Maris