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:
23P | Oracle Solaris on SPARC (64-bit) |
212P | IBM AIX on POWER Systems (64-bit) |
226P | Linux x86-64 |
233P | Microsoft 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:
36233263 | Database release update 19.3.0.0.0 |
36195566 | JDK bundle patch 19.0.0.0.240416 |
36199232 | OJVM release update 19.23.0.0.0 |
36420641 | DATAPUMP BUNDLE PATCH 19.23.0.0.0 |
33427856 | Gathering statistics for indexes on large tables in 19c may be time-consuming |
6880880 | OPatch 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!
One Response
It seems that this functionality has been included in latest version of autoupgrade with one-button-patching option for standalone instances. You may want to have a look at it.
Regards,
Xabi