This blog post was originally released on Pythian blog
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 Piwowar published a blog post on [Retrieving Oracle patches with wget(http://only4left.jpiwowar.com/2009/02/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(http://bit.ly/getMOSPatch) 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
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'  [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: email@example.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=allto download all found patches without being asked to choose ones from the list.
- you can also specify parameter
regexpto 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
mosPassbefore 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: firstname.lastname@example.org 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 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: email@example.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: firstname.lastname@example.org 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