getMOSPatch.sh - Downloading Patches From My Oracle Support
The transition away from FTP access in My Oracle Support (MOS) several years ago introduced a significant hurdle for DBAs: how to download patches directly to a server without a browser. Common workarounds, such as using VNC desktops or manually editing WGET scripts on a workstation, are cumbersome and inefficient.
To eliminate browser dependency entirely, I’ve developed a shell script, getMOSPatch.sh, designed specifically for Linux environments to streamline the patching process.
1) Installation and Initial Setup
The script utilizes standard Linux utilities like awk, sed, grep, and wget. You can download the script directly to your server using the following command
[oracle@mel1 Patches]$ wget --no-check-certificate -nv https://raw.github.com/MarisElsins/TOOLS/master/Shell/getMOSPatch.sh [oracle@mel1 Patches]$ chmod u+x getMOSPatch.sh
Configuring Platforms and Languages
The first time you run the script, or when you use the reset=yes parameter, it will prompt you to select your target platforms and languages. These settings are saved in a local configuration file for future use
[oracle@mel1 Patches]$ ./getMOSPatch.sh reset=yes Oracle Support Userid: your_email@example.com Oracle Support Password: Getting the Platform/Language list Available Platforms and Languages: ... 226P - Linux x86-64 912P - Microsoft Windows (32-bit) ... 4L - German (D) ... Comma-delimited list of required platform and language codes: 226P,4L
2) Core Features and Parameters
Once configured, downloading patches is as simple as providing the patch numbers. The script handles search and retrieval automatically based on your saved preferences.
Key Functional Logic:
- Automatic Selection: If only one file matches the patch number, it downloads automatically.
- User Choice: If multiple files are found (e.g., for different Oracle releases), the script prompts you to choose.
- Automated Downloads: Use
download=allto bypass prompts and download every matching file found. - Regex Filtering: Use the
regexpparameter to filter by filename—ideal for Apps DBAs needing specific R12 versions (e.g.,regexp=".*B_R12.*"). - Credential Handling: Set the environment variables
mosUserandmosPassto bypass manual login prompts.
3) Real-World Examples
Example A: Downloading a Specific CPU Patch
This example shows a standard download for the October 2013 CPU patch on Linux x86-64
[oracle@mel1 Patches]$ ./getMOSPatch.sh patch=16902043 Getting patch 16902043 for "Linux x86-64" p16902043_112030_Linux-x86-64.zip completed with status: 0
Example B: Choosing from Multiple Release Options
When downloading OPatch, multiple versions often exist for the same platform. The script allows for manual selection
[oracle@mel1 Patches]$ export mosUser=your_email@example.com [oracle@mel1 Patches]$ ./getMOSPatch.sh patch=6880880 1 - p6880880_112000_Linux-x86-64.zip 2 - p6880880_111000_Linux-x86-64.zip 3 - p6880880_121010_Linux-x86-64.zip Comma-delimited list of files to download: 3
Example C: Mass Downloads with Regex Filtering
For E-Business Suite environments, you can combine multiple patch numbers with regex filters to target specific release levels (e.g., R12.1) across all chosen languages
[oracle@mel1 Patches]$ ./getMOSPatch.sh regexp=".*B_R12.*" patch=10020251,10141333 download=all Getting patch 10020251 for "Linux x86-64" p10020251_R12.AR.B_R12_LINUX.zip completed with status: 0
Oracle Database Consulting Services
Ready to optimize your Oracle Database for the future?
Share this
Share this
More resources
Learn more about Pythian by reading the following blogs and articles.
3 Tips on Using dg4odbc on 64-bit Linux
HugePages for Oracle database in Oracle Cloud

Automating Oracle RMAN Backup Reports with PL/SQL Using the RMAN Catalog
Ready to unlock value from your data?
With Pythian, you can accomplish your data transformation goals and more.