Download patches like a pro

Patching is a regular task on every DBA’s to-do list, and involves logging into My Oracle Support and following the steps below:

1. Go to the tab [Patches & Updates].

2. Enter patch number.

3. Select platform.

4. Press the button [Search].

5. Select, from the list of results, the patch associated to the Oracle version to which you are going to apply it.

6. Press the button [Download]

7. Click on the link.

Although it is not complicated, imagine you need to download about twenty patches, and you have to repeat these 7 steps over and over again!

Fortunately, there is a faster and more efficient way to do this.

getMOSPatch to the rescue

Maris Elsins went to the trouble of creating a Java program that simplifies and speeds up patch downloading: getMOSPatch.

Without further ado, let’s see how to use it:

a. Download it from GitHub.

wget "https://github.com/MarisElsins/getMOSPatch/raw/master/getMOSPatch.jar" -q

b. Run it, requesting the download of the patch 36285197, but for RU 19.23, and for Linux x64..

java -jar getMOSPatch.jar \
MOSUser=enrique@gmail.com \
MOSPass=Oracle_4U$ \
patch=36285197 \
regexp=".*1923000.*" \
platform=226P \
stagedir="/stage"
download=all

Note that we have provided as parameters the user (MOSUser) and password (MOSPass) with which we connect to My Oracle Support; the patch number (patch); the desired RU (regexp); the platform (platform); and the directory where we want it to be downloaded (stagedir).

If several patches are required, we simply separate them with commas, taking care not to leave blank spaces between them; the same with the platforms.

Regarding the platform, the most common values are:

23POracle Solaris on SPARC (64-bit)
212PIBM AIX on POWER Systems (64-bit)
226PLinux x86-64
233PMicrosoft Windows x64 (64-bit)

Definitive example

Let’s imagine that we want to apply the latest Release Update (19.23) to our Oracle 19c installations, along with some recommended patches (note 555.1 in MOS) and the latest version of OPatch, both for AIX and Linux, according to the following list:

36233263Database release update 19.3.0.0.0
36195566JDK bundle patch 19.0.0.0.240416
36199232OJVM release update 19.23.0.0.0
36420641DATAPUMP BUNDLE PATCH 19.23.0.0.0
33427856Gathering statistics for indexes on large tables in 19c may be time-consuming
6880880OPatch 12.2.0.1.42 for DB 19.0.0.0.0

Only the one-offs are associated with RU 19.23, while the rest of the patches do not depend on RU but are associated with 19c itself, so it will require 2 calls to getMOSPatch, with different values fo regexp:

$ java -jar getMOSPatch.jar patch=36233263,36195566,36199232,6880880 regexp=".*19000.*" platform=212P,226P download=all

Downloading all selected files:
 Downloading /stage/p36233263_190000_AIX64-5L.zip: 1874MB at average speed of 1872KB/s - DONE!
 Downloading /stage/p36233263_190000_Linux-x86-64.zip: 1770MB at average speed of 25265KB/s - DONE!
 Downloading /stage/p36195566_190000_AIX64-5L.zip: 153MB at average speed of 3582KB/s - DONE!
 Downloading /stage/p36195566_190000_Linux-x86-64.zip: 120MB at average speed of 24018KB/s - DONE!
 Downloading /stage/p36199232_190000_AIX64-5L.zip: 125MB at average speed of 2822KB/s - DONE!
 Downloading /stage/p36199232_190000_Linux-x86-64.zip: 121MB at average speed of 25612KB/s - DONE!
 Downloading /stage/p6880880_190000_AIX64-5L.zip: 168MB at average speed of 7825KB/s - DONE!
 Downloading /stage/p6880880_190000_Linux-x86-64.zip: 127MB at average speed of 19238KB/s - DONE!
$ java -jar getMOSPatch.jar patch=36420641,33427856 regexp=".*1923000.*" platform=212P,226P download=all

Downloading all selected files:
 Downloading /stage/p36420641_1923000DBRU_Generic.zip: 2MB at average speed of 2947KB/s - DONE!
 Downloading /stage/p33427856_1923000DBRU_Generic.zip: 0MB at average speed of 848KB/s - DONE!

For simplicity, some parameters, such as  MOSUser and MOSPass, have not been shown.

The final result is:

$ ls -l /stage

total 9257664
-rw-r--r--  160694091 Jun 30 p36195566_190000_AIX64-5L.zip
-rw-r--r--  126843335 Jun 30 p36195566_190000_Linux-x86-64.zip
-rw-r--r--  131554204 Jun 30 p36199232_190000_AIX64-5L.zip
-rw-r--r--  127475677 Jun 30 p36199232_190000_Linux-x86-64.zip
-rw-r--r-- 1965829022 Jun 30 p36233263_190000_AIX64-5L.zip
-rw-r--r-- 1856311021 Jun 30 p36233263_190000_Linux-x86-64.zip
-rw-r--r--  176769223 Jun 30 p6880880_190000_AIX64-5L.zip
-rw-r--r--  133535622 Jun 30 p6880880_190000_Linux-x86-64.zip
-rw-r--r--     519356 Jun 30 p33427856_1923000DBRU_Generic.zip
-rw-r--r--    2670772 Jun 30 p36420641_1923000DBRU_Generic.zip

What did you think? Undoubtedly getMOSPatch will alleviate the headache of having to download multiple patches. Now we just have to take note of the patch numbers we need and that’s it, in minutes we will have them available to apply them in our entire Oracle infrastructure!

Did you find this article interesting, did you have any doubts, do you want to suggest a topic to cover, leave me your comments or contact me me right now!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts

Learn how to resolve the CRS-2304 GPnP profile signature verification failed error when starting an 11.2 database on a 19c cluster.
Learn how to fix corrupted permissions on an Oracle Home, either Oracle Grid or Oracle Database Server.
Learn how to improve the security of your applications using Oracle Wallet / Secure External Password Store.

Need Help?

Fill in these details and I will be in touch as soon as possible.