Home » Oracle » Oracle Database » How to download Patch from Oracle using Wget

How to download Patch from Oracle using Wget

how to download patch using wget

Patches can be downloaded using command line download manager utility such as wget.

1.First we need to check if we have wget installed in the system
You can use below command

 which wget

or

 locate wget 

2. Make sure it is compiled with SSL option

$ wget –help (Below output shows that wget is compiled with SSL options)

HTTPS (SSL/TLS) options:
--secure-protocol=PR choose secure protocol, one of auto, SSLv2,
SSLv3, and TLSv1.
--no-check-certificate don't validate the server's certificate.
--certificate=FILE client certificate file.
--certificate-type=TYPE client certificate type, PEM or DER.
--private-key=FILE private key file.
--private-key-type=TYPE private key type, PEM or DER.
--ca-certificate=FILE file with the bundle of CA's.
--ca-directory=DIR directory where hash list of CA's is stored.
--random-file=FILE file with random data for seeding the SSL PRNG.
--egd-file=FILE file naming the EGD socket with random data.

NOTE: If the wget utility does not have support for SSL then step 6 below will fail (because the –no-check-certificate option will not be recognised)

3. Now that we have the wget utility fully ready to download the patches, we need to find the link of the patch

For eg; to download Patch 1111111 for Sun Solaris SPARC (64-bit) follow below instructions :

From My Oracle Support Portal :

  • Login to “My Oracle Support”
  • Search for the patch
  • Go to the download page
  • Click to Select the Row for Patch to be downloaded
  • Click “Download”
  • Right Click on Patch Zip file displayed
  • Copy URL
It will be below type
https://updates.oracle.com/Orion/Download/process_form/p8836308_10204_Linux-x86.zip?file_id=28333323&aru=11735575&userid=o-xyz&email=xyz&patch_password=&patch_file=p8836308_10204_Linux-x86.zip

Directly from Browser :

https://updates.oracle.com/download/1111111.html
In Platform or Language : choose Sun Solaris SPARC (64-bit)
On the same page on the Download Button->Right Click on the Download->Copy link location

https://updates.oracle.com/Orion/Services/download/p8836308_10204_Solaris-64.zip?aru=11774514&patch_file=p8836308_10204_Solaris-64.zip

or

  • Login to “My Oracle Support
  • Search for the patch
  • Go to the download page
  • Click to Select the Row for Patch to be downloaded
  • Click “Download”
  • At Bottom Click “WGET options”
  • Click on Download .sh. You will get wget.sh file
Wget Script
 !/bin/sh
 #
 #Generated 11/1/19 12:33 PM
 #Start of user configurable variables
 #
 LANG=C
 export LANG
 #Trap to cleanup cookie file in case of unexpected exits.
 trap 'rm -f $COOKIE_FILE; exit 1' 1 2 3 6
 SSO username
 printf 'SSO UserName:'
 read SSO_USERNAME
 #Path to wget command
 WGET=/usr/bin/wget
 #Log directory and file
 LOGDIR=.
 LOGFILE=$LOGDIR/wgetlog-$(date +%m-%d-%y-%H:%M).log
 #Print wget version info
 echo "Wget version info:
 $($WGET -V)
 ------------------------------" > "$LOGFILE" 2>&1
 #Location of cookie file
 COOKIE_FILE=$(mktemp -t wget_sh_XXXXXX) >> "$LOGFILE" 2>&1
 if [ $? -ne 0 ] || [ -z "$COOKIE_FILE" ]
 then
  echo "Temporary cookie file creation failed. See $LOGFILE for more details." |  tee -a "$LOGFILE"
  exit 1
 fi
 echo "Created temporary cookie file $COOKIE_FILE" >> "$LOGFILE"
 Output directory and file
 OUTPUT_DIR=.
 #
 #End of user configurable variable
 #The following command to authenticate uses HTTPS. This will work only if the wget in the environment
 #where this script will be executed was compiled with OpenSSL.
 #
  $WGET  --secure-protocol=auto --save-cookies="$COOKIE_FILE" --keep-session-cookies  --http-user "$SSO_USERNAME" --ask-password  "https://updates.oracle.com/Orion/Services/download" -O /dev/null 2>> "$LOGFILE"
 Verify if authentication is successful
 if [ $? -ne 0 ]
 then
  echo "Authentication failed with the given credentials." | tee -a "$LOGFILE"
  echo "Please check logfile: $LOGFILE for more details."
 else
  echo "Authentication is successful. Proceeding with downloads…" >> "$LOGFILE"
 $WGET  --load-cookies="$COOKIE_FILE" "https://updates.oracle.com/Orion/Services/download/p8836308_10204_Solaris-64.zip?aru=11774514&patch_file=p8836308_10204_Solaris-64.zip" -O "$OUTPUT_DIR/p8836308_10204_Solaris-64.zip"   >> "$LOGFILE" 2>&1 
 fi
 Cleanup
 rm -f "$COOKIE_FILE"
 echo "Removed temporary cookie file $COOKIE_FILE" >> "$LOGFILE"

4. Now you have Various Option to download the patch

See also  Mechanism Following by Oracle when we taking hot backup

a. Copy the downaloadec wget.sh script from Patch download option to the Server box and then execute it using shell

It will ask for Username and Password and then download the patch

sh wget.sh

b. You can using this custom wget command. Here file_url is the URL copied from Copy URL link previously

wget --http-user=xyz --ask-password "file_url" -O file_name
wget --http-user=MOS_USER --http-password=MOS_PASSWORD --no-check-certificate  -O $OUTPUT_FILE "$i"

c. We can download using these below command also

wget  --secure-protocol=auto --save-cookies="./cookies.txt" --keep-session-cookies  --http-user "$SSO_USERNAME" --ask-password    "https://updates.oracle.com/Orion/Services/download" 
wget  --load-cookies= ./cookies.txt  "file_url" -O file_name 

We can download Multiple download by just having cookie once and then downloading multiple patches using the above command

The Oracle download sites always provide digests for the available files in the form of checksums, SHA-1 or MD5 hashes. To verify that the downloaded files are ok, simply execute the corresponding command, as shown in the examples below, and compare the output string with the value shown on the download site:

For checksum:

$ cksum p8836308_10204_Solaris-64.zip
4109851411 3710976 p8836308_10204_Solaris-64.zip

For MD5:

$ md5sum p8836308_10204_Solaris-64.zip
48a4a957e2d401b324eb89b3f613b8bb p8836308_10204_Solaris-64.zip

For SHA-1:

$ sha1sum p8836308_10204_Solaris-64.zip
43a70298c09dcd9d59f00498e6659063535fee52 p8836308_10204_Solaris-64.zip

Hope you like article on how to download Patch from Oracle using Wget to save time and speed up your work. This should be helpful for Oracle DBA and infrastructure people.

if wget is not the option on your site, you may create a VNC session on the server and then open fire fox browser and login to Oracle site to download the patch also. This will save time of transferring from your files from PC to server and download will be faster

See also  How to setup diag wait in cluster

Related Articles
check patches applied in weblogic :This page contain details on how to check patches applied in weblogic in version 10.3.6,12.1.1,12.1.1 above with commands
check Patch application in R12.1 /R12.2 :learn How to check Patch application in Oracle E-Business Suite instance R12/R12.2
rollback the oracle patch : check out this on how to rollback the oracle patch like database patch,application patch,Application server patch with detailed steps
How to run Opatch in non interactive form : Learn How to run Opatch in non interactive form
opatch failed with error code 73 : Cause and Resolution for Top and command Opatch issues in Window
opatch version command : check out this post on How to check the opatch version or opatch version command, apply the patch(opatch apply), Upgrade, opatch lsinventory

2 thoughts on “How to download Patch from Oracle using Wget”

  1. Wow! What an excellent article!!! It is very helpful for me. I’ve learnt a lot of things from this post, thank you.

Leave a Comment

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

Scroll to Top