Friday, January 9, 2015

Using Wget to get Oracle Patches

A little known metalink feature is using wget to download patches.

This can help tremendously in reducing the amount of crud you have to move around from desktop to server as patches can be very big, and people's desktop connections very slow indeed.

The usual patch download process is to find the patch in metalink, then download to the PC, then FTP or SFTP to the server to be patched.

Using Wget lets us download the file direct from metalink to the server in question.

So how to do this wget step ?


Let's assume we start both from the same point :


Here we are downloading opatch, a fairly common patching tool

If I click on the link we will have the patch downloaded to my PC.

But in the bottom we can see WGET options.  Let's look at that :


It tells us we will download a little script that will actually get the files for us, rather than the large download.  This sounds nice.  Let's do that so press the button. 

What we're seeing is windows 8.1 downloading the file to the desktop and asking if we want to open or save it. Notepad is not good with shell scripts cos it doesn't do CRLFs very well so we will save it instead ! 

When we open that file with a proper editor we see



Ok so what do we do with this.   On the database server or host which you want to patch, open a vi editor



Now copy the contents of the script into the vi editor :  ctrl-A to select all , paste into the terminal emulator




OK - can we use this :  We still have to edit it to change it for the correct userid and password so go up to the top of the file
Edit the lines SSO_USERNAME and SSO_PASSWORD to be whatever you use for Metalink like :

SSO_USERNAME=dingo@xyz.com
SSO_PASSWORD=swordfish

NOW we can use this ! 

Exit to the shell and chmod +x the script, and execute it.

You may run into the problem or two with wget, which is the mechanism for getting the patch  not working.   When you try and check this you will see what wget cannot connect to updates.oracle.com  .    Deep checking shows that this is because the SSL server cannot seem to handle TLS V1.2  - this is not a client side issue, even recompiling to the latest version of wget will not solve it.   The only way of doing this is to tell the wget client to downgrade its SSL protocol to TLSV1 only  - you can do that by adding --secure-protocol=TLSV1 and then it all works.

[oracle@ebscloud patches]$ sh dl.sh
[oracle@ebscloud patches]$ ls -lrt
total 53400
-rw-r--r-- 1 oracle oinstall 54484029 Nov 28 14:18 p6880880_111000_Linux-x86-64.zip
-rwxr-xr-x 1 oracle oinstall     1964 Jan  9 08:00 dl.sh
-rw-r--r-- 1 oracle oinstall     3329 Jan  9 08:00 download

[oracle@ebscloud patches]$

And now it has downloaded our patch ! 



No comments: