getMOSPatch.sh – Downloading Patches From My Oracle Support

Posted in: Technical Track

How to download patches from My Oracle Support (MOS) directly to the server? This has bothered me since the ftp access was closed a few years ago. Of course, I’ve been given some options by Oracle, like, I could access MOS from the server using a browser (probably from a VNC desktop – thank you very much), or I could look up the patches on my workstation to download the WGET script from MOS, which I uploaded to the server, adjusted with the username and the password of my MOS account and then started the downloads. Not too convenient, is it?
Then, back in 2009 my teammate John published a blog post on Retrieving Oracle patches with wget. This eliminated the need to upload the wget script from MOS to the server and I only had to get the URLs of the patches and pass them to a shell function. While this was so much easier, I still needed to open the browser to find those URLs.
I think it’s time to get rid of browser dependency. So I’ve written a shell script getMOSPatch.sh that can be used to download patches directly to the server using only the patch number.
I’ve tested the tool on Linux, and there is a good chance it won’t work on some other platforms as it utilizes tools like awk, sed, grep, egrep and wget with options that probably only work on Linux, but if there’s much interest in this tool and I get many comments on this blog post I promise to change that :)
You can use wget to download the script to the server directly:

[oracle@mel1 Patches]$ wget --no-check-certificate -nv https://raw.github.com/MarisElsins/TOOLS/master/Shell/getMOSPatch.sh
WARNING: cannot verify raw.github.com's certificate, issued by `/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3':
  Unable to locally verify the issuer's authority.
2013-11-10 17:42:17 URL:https://raw.github.com/MarisElsins/TOOLS/master/Shell/getMOSPatch.sh [4021/4021] -> "getMOSPatch.sh" [1]
[oracle@mel1 Patches]$ chmod u+x getMOSPatch.sh

First time you run the script (or when you run it with parameter reset=yes) it will let you choose which platforms and languages the patches need to be downloaded for and the choices will be saved in a configuration file. The available platforms and languages are fetched from MOS.

[oracle@mel1 Patches]$ ./getMOSPatch.sh reset=yes
Oracle Support Userid: elsins@pythian.com
Oracle Support Password:

Getting the Platform/Language list
Available Platforms and Languages:
527P - Acme Packet OS
293P - Apple Mac OS X (Intel) (32-bit)
522P - Apple Mac OS X (Intel) (64-bit)
...
226P - Linux x86-64
912P - Microsoft Windows (32-bit)
...
7L - Finnish (SF)
2L - French (F)
4L - German (D)
104L - Greek (EL)
107L - Hebrew (IW)
...
39L - Ukrainian (UK)
43L - Vietnamese (VN)
999L - Worldwide Spanish (ESW)
Comma-delimited list of required platform and language codes: 226P,4L
[oracle@mel1 Patches]$

After this you simply have to run the script with parameter patch=patchnr1,patchnr2,… and the listed patches will be downloaded. This is how it happens:

  • the script looks up each of the patches for each platform and language and:
    • if one patch is found – it is automatically downloaded
    • if multiple patches are found (this can happen if the same patch is available for multiple releases) – the tool will ask you to choose which patches to download.
  • you can also specify parameter download=all to download all found patches without being asked to choose ones from the list.
  • you can also specify parameter regexp to apply filters to the filenames of the looked up patches. This is especially useful for Apps DBAs as filter regexp=”.*A_R12.*” would be helpful for e-Business Suite Release 12.0 and regexp=”.*B_R12.*” – for R12.1.
  • if you set environment variables mosUser and mosPass before running the script you won’t be asked to enter the user credentials.

Take a look at the following examples:

  • downloading the latest CPU patch (patch 16902043, OCT2013) for 11gR2.
    [oracle@mel1 Patches]$ ./getMOSPatch.sh patch=16902043
    Oracle Support Userid: elsins@pythian.com
    Oracle Support Password:
    
    Getting patch 16902043 for "Linux x86-64"
    p16902043_112030_Linux-x86-64.zip completed with status: 0
    
    Getting patch 16902043 for "German (D)"
    no patch available
    
  • Downloading the latest patch for OPatch (there are multiple patches available on the same platform):
    [oracle@mel1 Patches]$ export mosUser=elsins@pythian.com
    [oracle@mel1 Patches]$ ./getMOSPatch.sh patch=6880880
    Oracle Support Password:
    
    Getting patch 6880880 for "Linux x86-64"
    1 - p6880880_112000_Linux-x86-64.zip
    2 - p6880880_111000_Linux-x86-64.zip
    3 - p6880880_121010_Linux-x86-64.zip
    4 - p6880880_131000_Generic.zip
    5 - p6880880_101000_Linux-x86-64.zip
    6 - p6880880_102000_Linux-x86-64.zip
    Comma-delimited list of files to download: 3
    p6880880_121010_Linux-x86-64.zip completed with status: 0
    
    Getting patch 6880880 for "German (D)"
    no patch available
    [oracle@mel1 Patches]$
    
  • Downloading multiple patches at the same time without prompting user to specify which files to download if multiple files are found. (don’t be confused that files with “LINUX” and not “Linux-x86-64” in the filename are downloaded here. These are e-Business Suite patches and both 32b and 64b platforms have the same patch):
    [oracle@mel1 Patches]$ ./getMOSPatch.sh patch=10020251,10141333 download=all
    Oracle Support Userid: elsins@pythian.com
    Oracle Support Password:
    
    Getting patch 10020251 for "Linux x86-64"
    p10020251_R12.AR.B_R12_LINUX.zip completed with status: 0
    p10020251_R12.AR.A_R12_LINUX.zip completed with status: 0
    
    Getting patch 10020251 for "German (D)"
    p10020251_R12.AR.A_R12_d.zip completed with status: 0
    
    Getting patch 10141333 for "Linux x86-64"
    p10141333_R12.AR.A_R12_LINUX.zip completed with status: 0
    p10141333_R12.AR.B_R12_LINUX.zip completed with status: 0
    
    Getting patch 10141333 for "German (D)"
    p10141333_R12.AR.B_R12_d.zip completed with status: 0
    p10141333_R12.AR.A_R12_d.zip completed with status: 0
    
  • Downloading the same patches as in the previous example with an additional filter for e-Business Suite 12.1 patches only:
    [oracle@mel1 Patches]$ ./getMOSPatch.sh regexp=".*B_R12.*" patch=10020251,10141333 download=all
    Oracle Support Userid: elsins@pythian.com
    Oracle Support Password:
    
    Getting patch 10020251 for "Linux x86-64"
    p10020251_R12.AR.B_R12_LINUX.zip completed with status: 0
    
    Getting patch 10020251 for "German (D)"
    no patch available
    
    Getting patch 10141333 for "Linux x86-64"
    p10141333_R12.AR.B_R12_LINUX.zip completed with status: 0
    
    Getting patch 10141333 for "German (D)"
    p10141333_R12.AR.B_R12_d.zip completed with status: 0
    
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.

53 Comments. Leave new

Great piece of work, Maris!!!

Reply

Thanks for the great work my friend Maris! We whole community is getting better and more efficient because of ideas and solutions like yours :)

Thanks A TON :)

Yury

Reply
Saurabh K. Gupta
November 12, 2013 2:24 am

Truely awesome. Yet to test it out but looks promising stuff!!

Reply

Great script and very creative.

Reply

Great Work Thanks For Sharing

Reply

Features request to download checksum file and/or perform checksum.

Thanks Michael.

Reply
Jeremy Schneider
December 4, 2013 10:33 am

Looks cool Maris – I’m going to try this out when I have a chance!

Reply

Thanks all!
Just a reminder, if you find any issues, let me know and I’ll try to fix them!

Reply
Andrejs Karpovs
December 11, 2013 9:37 am

Hey Maris,

The tool works great! Just used it to download 11.2.0.4 database patchset.

$ ./getMOSPatch.sh patch=13390677
Oracle Support Userid:
Oracle Support Password:

Getting patch 13390677 for “Linux x86-64”
1 – p13390677_112040_Linux-x86-64_1of7.zip
2 – p13390677_112040_Linux-x86-64_2of7.zip
3 – p13390677_112040_Linux-x86-64_3of7.zip
4 – p13390677_112040_Linux-x86-64_4of7.zip
5 – p13390677_112040_Linux-x86-64_5of7.zip
6 – p13390677_112040_Linux-x86-64_6of7.zip
7 – p13390677_112040_Linux-x86-64_7of7.zip
Comma-delimited list of files to download: 1,2
Downloading file p13390677_112040_Linux-x86-64_1of7.zip …
p13390677_112040_Linux-x86-64_1of7.zip completed with status: 0
Downloading file p13390677_112040_Linux-x86-64_2of7.zip …
p13390677_112040_Linux-x86-64_2of7.zip completed with status: 0

No issues so far.

Regards,
Andrejs.

Reply

I am observing below error while running you script
WARNING: cannot verify login.oracle.com’s certificate, issued by `/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)10/CN=VeriSign Class 3 International Server CA – G3′:
Unable to locally verify the issuer’s authority.
Authorization failed.

Is there any change in the downloading process of the patches in oracle

Reply

Hi Sumeet,

could you check again?
I observed similar issues today, but now it’s back to normal.
It looks like something happened on the My Oracle Support side.

Maris

Reply

Yes it is working now . I have doubt that the script does not ask where the requested patch is R12.1 or R12.0

Reply

If the same patch exists for R12.1 and R12.0 it will list both patches and you’ll be able to choose witch one to download. Alternatively you can use parameters: regexp=”.*B_R12.*” for R12.1 patches and regexp=”.*A_R12.*” for R12.0.

Reply

One thing I’ve noticed in this case is that if a patch is superseded or obsolete, it will be skipped. This is usually a good thing, but it can cause some confusion when downloading patches for R12. Example: 1) A My Oracle Support note instructs you to download 12345678 for 12.1.
2) Patch 12345678 exists for codelines A and B
3) Patch 12345678 is superseded by patch 12349999 in codeline B

Result: getMOSPatch.sh will download 12345678.A, but not 12345678.B

Lesson: Review your download results AND the Oracle patch docs carefully. But we all do that already, right? :)

Reply
bharath. Panuganti
April 2, 2014 11:56 pm

Can it be used for downloading media from e-delivery? Say for ex : 12.2 media pack

Reply

No, this tool it’s specific to My Oracle Support.

Reply
John Piwowar
April 4, 2014 8:31 am

Hi Bharath,

One of our Pythian colleagues has compiled a list of methods for non-interactive downloads from MOS, OTN, and eDelivery. Please look at http://www.pythian.com/blog/how-to-download-oracle-software-using-wget-or-curl/ and see if that helps. Personally, I use “Method 2” in that post for eDelivery.

Reply

I tried running this script, getMOSPatch.sh reset=yes, and after entering my MOS username and pwd, the message returned is “Unable to establish SSL connection.” wget version is 1.12. I can connect OK via my browser to MOS.

Any suggestions?

Thanks

Reply
Maris Elsins
April 7, 2014 1:25 am

Hi Joel,

I’ve seen this happening time to time, but every times I checked that there was something wrong with the authentication process on MOS side. It’s a different authentication process if you log on using the browser, so that might work while the other one doesn’t.
Could you check it later again? And let me know if it started working please.

P.S. If you have a really complex password with different special characters – it might confuse wget. I’d appreciate if you could figure out which special character is causing trouble (or let me know which ones you’re using in the password) so I can test it and apply a “special treatment” for it in the script.

Maris

Reply

Thanks. The password is number and letters only, no special characters. However, I think the problem must be on the Oracle side. I downloaded one of the MOS-supplied wget scripts and I’m getting the same (failed) result.

Reply

New info: I grabbed a copy of wget 1.15 and everything is working. Thanks again…this script rocks!

Reply
Maris Elsins
April 9, 2014 2:36 am

Thanks for the update, I’ll update the the post to let everyone know that the version of wget is important!

Reply

Nice script!! If you add –secure-protocol=TLSv1 in every wget instruction on the script it will work with any version of wget. I tried it and it works like a charm.

Reply

Hi Sammy,

Thanks for the advice, I’ll test it and I will update the script if it works!

Maris

Reply
Cameron Hodge
May 2, 2014 4:25 am

Love your work. Linux 6.5 with wget 1.12. Just added into each wget command –secure-protocol=TLSv1

Reply
Maris Elsins
May 2, 2014 6:01 am

Thanks a lot!

I’ve also updated the file on GitHub to add “–secure-protocol=TLSv1”.

Maris

Reply
Cameron Hodge
May 2, 2014 4:27 am

Migration to R12.2.3 coming soon. 15+ languages. I think this will save a few hours. I you a beer if we ever meet

Reply

Hi Maris.

Nice Script that you have.
I tried that on Centos 6.4
First I run with reset=yes
Next
Put the Platform and Language already
But it seems I can’t get patch # 18741545, 18555488, 18741369

Did I miss something ?

Reply
Maris Elsins
July 28, 2014 9:38 am

Hi,

same thing here:
Maris:99_TMP melsins$ ./getMOSPatch.sh reset=yes
Oracle Support Userid: elsins@pythian.com
Oracle Support Password:

Getting the Platform/Language list
Available Platforms and Languages:
...
226P - Linux x86-64
...
Comma-delimited list of required platform and language codes: 226P
Maris:99_TMP melsins$ ./getMOSPatch.sh patch=18741545,18555488,18741369
Oracle Support Userid: elsins@pythian.com
Oracle Support Password:

Getting patch 18741545 for "Linux x86-64"
no patch available

Getting patch 18555488 for "Linux x86-64"
no patch available

Getting patch 18741369 for "Linux x86-64"
no patch available

And when I check the patches directly from the simple patch search in MOS I see the message “You do not have the required access privilege to download this patch.” That’s also why downloading doesn’t work.
I’ll take a look if I can update the script to display the error messages too.

Thanks for the feedback,
Maris

Reply

Thanks! I was at my hotel with VPN, wondering how in the world can I download a 3GB installation file. I googled “wget oracle download” and came across this article, and you saved my day.

Reply

Glad it worked!

Reply
Arthur Kettelhut
February 13, 2015 9:44 am

Greatly appreciate not having to reinvent the wheel. Thanks!

Reply
Jacco H. Landlust
March 9, 2015 3:27 pm

Thanks for providing this script! However all my downloads of the freshly downloaded getMOSPatch.sh script ended up with:

curl: (35) Unknown SSL protocol error in connection to updates.oracle.com:443

Work around: replacing curl –tlsv1 with curl -3 on line 134.

Google suggests this could be a bug in curl.

Reply
Maris Elsins
March 9, 2015 3:30 pm

Hi Jacco,
Which version of curl it is?

Reply
Jacco H. Landlust
March 9, 2015 4:13 pm

Hi Maris,

jacco@oracle-jacco:~$ curl –version
curl 7.37.1 (x86_64-pc-linux-gnu) libcurl/7.37.1 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

Reply
Abhishek Rajput
April 3, 2015 2:46 am

I tried downloading patches, scripts was successful.
But in some cases it gives ambiguity.

like as,

Getting list of files for patch 16867777 for “Oracle Solaris on SPARC (64-bit)”
1 – p16867777_R12.JE.B_R12_GENERIC.zip
2 – p16867777_R12.JE.B_R12_GENERIC.zip
Comma-delimited list of files to download:

Both the patches are having same code levels as ‘*JE.B_R12*’.

This is not in case of every patch. Please suggest.

Reply
Maris Elsins
May 20, 2015 3:49 am

Hi Abhishek,

this was related to improper handling of password-protected files.
I’ve uploaded a new version to fix this.

maris

Reply
Abhishek Rajput
April 3, 2015 11:24 pm

Hi Maris,

I tried to download using regexp for R12.1.

./getMOSPatch.sh patch=17971181 regexp=”.*B_R12.*”

Getting list of files for patch 17971181 for “Oracle Solaris on SPARC (64-bit)”
1 – p17971181_R12.JE.B_R12_GENERIC.zip
2 – p17971181_R12.JE.B_R12_GENERIC.zip
Comma-delimited list of files to download: 1

Getting list of files for patch 17971181 for “Czech (CS)”
1 – p17971181_R12.JE.B_R12_cs.zip
2 – p17971181_R12.JE.B_R12_cs.zip
Comma-delimited list of files to download: 1

Getting list of files for patch 17971181 for “German (D)”
1 – p17971181_R12.JE.B_R12_d.zip
2 – p17971181_R12.JE.B_R12_d.zip
Comma-delimited list of files to download: 1

Getting list of files for patch 17971181 for “Spanish (E)”
1 – p17971181_R12.JE.B_R12_e.zip
2 – p17971181_R12.JE.B_R12_e.zip
Comma-delimited list of files to download:

Please suggest, what is going bad for me. Every patch is coming duplicate for same code level.

Reply
Maris Elsins
May 20, 2015 3:51 am

Hi Abhishek,

Please try again, I think I’ve resolved these issues, at least I couldn’t reproduce the issue after the recent updates.
Also, please not, I think the correct way of passing the regexp parameter is without the quotes, like this : regexp=.*B_R12.*

Maris

Reply

Hi,

there is some problem with downloading of patches:

./getMOSPatch.sh patch=13800972
Oracle Support Userid: ###
Oracle Support Password: ###

Getting list of files for patch 13800972 for “Linux x86”
Files to download:
p13800972_101310_GENERIC.zip

Getting list of files for patch 13800972 for “Linux x86-64”
Files to download:
p13800972_101310_GENERIC.zip

Getting list of files for patch 13800972 for “Latin Serbian (LSR)”
no patch available

Downloading the patches:

But Patches are not downloaded

Reply
Maris Elsins
May 27, 2015 6:01 am

Thanks for the feedback, give me a second to take a look at it.

Reply
Maris Elsins
May 27, 2015 6:28 am

I fixed a bug. It should be working OK now.

Reply

Option to add American English please?

Reply

Hi Michael,

could you elaborate this a little bit? Where would you want to see that option?

Maris

Reply

Hi Maris,

While running script i am getting below error, Please help me out to solve this.

[oraoaa2@adm2cdb1 ~]$ ./getMOSPatch.sh reset=yes
Oracle Support Userid: **********************
Oracle Support Password:
wget: missing URL
Usage: wget [OPTION]… [URL]…

Try âwget –helpâ for more options.
./getMOSPatch.sh: line 53: https://updates.oracle.com/Orion/SimpleSearch/switch_to_saved_searches: No such file or directory
cat: ./.getMOSPatch.sh.tmp2: No such file or directory

Regards,
Ubaid

Reply

Hi Ubaid,

I looked into this and I can’t understand how you’re getting this error, I definitely can’t reproduce it.
What’s the OS and version you’re running this on?
What’s the version of the wget you’re using?
Can you run it using “bash -x ./getMOSPatch.sh reset=yes” and provide me the outputs to the email please? Just make sure to remove your password from the outputs you provide.
My email is elsins(at)pythian.com

regards,
Maris

Reply

Maris,
Nice script. Thank you for sharing
Regards,
Purush

Reply
Maris Elsins
March 9, 2016 2:51 am

Thanks Purush, enjoy!

Reply

Hi, This is an excellent script and I used it successfully. But I have a requirement to use this script my solaris environment and the script is failing due to grep/awk options [ which is expected ].

It would be greatly help us if this script can be modified for solaris environment.

Reply
Maris Elsins
June 27, 2016 6:29 am

Shhh, I’m silently working on rewriting this utility in java.

Reply
Andrey Chervonets
July 8, 2016 8:53 am

Old version is still working! tested on Oracle Linux 7.2. (64-bit)

Reply
Maris Elsins
July 8, 2016 12:49 pm

Hey,

Yes it does! But make sure you try the new one too ;)

Maris

Reply

Leave a Reply

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