Update #1, 13-Nov-2009: While testing this patch download method in the wake of the recent My Oracle Support cutover, I noticed a new wrinkle. Instead of a successful patch download, I got the following message from wget:Self-signed certificate encountered. To connect to login.oracle.com insecurely, use `--no-check-certificate'.
After adding --no-check-certificate to the wget command, I was once again able to retrieve patches, but it took a bit longer than usual, as wget wandered through a tree of redirects. I've updated the code for the getOraPatch function accordingly.
Update #2, also 13-Nov-2009: A commenter on Chris Warticki's Oracle Support blog noted that the patch download page provided by the Flash version of My Oracle Support does not present a right-clickable Download button, which would seem to render the wget patch retreival method useless. Thankfully, there's a workaround: open a new window/tab in your browser, using an URL of the form
https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=nnnnnnnThis will open a patch download page in a plain HTML, non-Flashy interface, and you should be all set to go!
No, no, this isn't a back door into the
Metalink My Oracle Support patch repository. Don't get too excited.
While working from home this evening, I had to download some patches to a remote Linux system, and was struck, not for the the first time, by the inconvenience of it all. The usual options seem to be:
- Download the patches to a local machine and upload them to the remote system -- annoyingly manual at best, and downright gross when a VPN connection is involved.
FTP from the remote system to updates.oracle.com. That's a tried-and true method, but still involves a lot of typing.Not anymore! This access option was disabled in November 2009, with the arrival of My Oracle Support.
- Start a VNC session on the remote system, launch a web browser, log in to
MetalinkMy Oracle Support, and click the download button. Not a bad option...unless you can't use VNC for some reason, and are stuck with a command-line interface. Or if you're trying to navigate in that remote browser over a VPN connection. Not an exercise for impatient people.
When life gives you inconvenience, write a shell function!
At least, I think that's how the old saying goes. I created the following bash(1) function that uses wget to download a patch from updates.oracle.com, using the URL behind the Download button:
The above function prompts for the username and password that you use to access
Metalink My Oracle Support. If the variables are already defined in your session, then it assumes you want to use the existing values and does not prompt you again. Then, the function parses the patch URL to find the patch's filename, and passes all four values (userid, password, URL, and filename) to wget.
- Load the above function into your shell session, or copy and paste the code into your .bash_profile to have it loaded when you log in.
- Log in to
MetalinkMy Oracle Support and locate the patch. Can't get around this step, but you can do it in a local browser, instead of dealing with a remote X session as described above in #3.
- Right-click on the Download button to copy the patch URL:
- Invoke the function, enclosing the super-long patch URL in single quotes:
oracle@testhost:/stage> getOraPatch 'really_long_patch_URL_copied_in_previous_step'
- Answer the prompts, and lean back and watch as wget retrieves your patch:
Oracle Support Userid: your_MyOracleSupport_login_here Oracle Support Password: your_MyOracleSupport_password_here (some wget output snipped) HTTP request sent, awaiting response... 200 OK Length: 52,028 [application/zip] 100%[====================================>] 52,028 --.--K/s 22:27:24 (555.94 KB/s) - `pnnnnnnn_version_platform.zip' saved [52028/52028]
- Repeat as necessary.
Disclaimers, caveats and commentary
- I've only tested this on Linux. Presumably, you could utilize this method on other Unix variants (and even Windows, if you're into that sort of thing).
- On Unix/Linux, make sure you enclose the patch URL in single quotes, or the shell will interpret all of the ampersands in the URL as, "wow, you want me to launch 5 or 6 background processes? O-kay!"
- Before copying the patch URL, make sure you've already selected the correct release and platform for the patch. The values of the aru and file_id parameters in the URL change as you select those values.
- You need to have wget installed on your system for this method to work as written above. It probably would be relatively easy to adapt this to use curl instead, but wget is what I thought to use first.
- Some versions of wget use
wget --helpto verify what's valid for your version.
- Using this function will leave the values of your Oracle Support userid and password in the shell variables $mosUser and $mosPass. If this makes you uncomfortable, remember to use
unseton those variables, or just exit your session, when you're done downloading.
- If you have any characters in your password that could be interpreted as metacharacters by the shell, you might need to escape them. I didn't test that too thoroughly.
A few random observations
- Yes, I'm downloading patches on a Friday night. And it's not urgent, strictly speaking. Do I know how to live, or what?
- According to The Google, my posting rate for the life of this blog is 0.2 posts/week. It's not every week that I get to surpass my average output by an order of magnitude.
- On second thought, at this rate, I could post twice a week for a while and still bask in the glow of that false feeling of productivity.