How to Patch Oracle Database With One Command

With the latest release of Oracle AutoUpgrade, patching an Oracle Database is much easier. Once I’ve configured AutoUpgrade, it takes just one command. That includes finding and downloading the right patches and creating a new Oracle home.

Let’s see how I can do it.

Configuration

  1. Get the latest version of AutoUpgrade:
    wget https://download.oracle.com/otn-pub/otn_software/autoupgrade.jar
    
  2. I need to create a config file:
    • global.global_log_dir is the logging and working directory of AutoUpgrade.
    • global.keystore is where AutoUpgrade can create a software keystore that stores my My Oracle Support credentials.
    • sid and source_home describe the database that I want to patch.
    • target_home is the location of the new Oracle home that AutoUpgrade creates for me.
    • folder is the location where AutoUpgrade can find or download patches.
    • patch tells AutoUpgrade to apply the latest Release Update including the OJVM and Data Pump bundle patches, plus update OPatch.
global.global_log_dir=/home/oracle/autoupgrade-patching/log
global.keystore=/home/oracle/autoupgrade-patching/keystore
patch1.source_home=/u01/app/oracle/product/19
patch1.target_home=/u01/app/oracle/product/19_25_0
patch1.sid=FTEX
patch1.folder=/home/oracle/autoupgrade-patching/patch
patch1.patch=RECOMMENDED
  1. Currently, AutoUpgrade can’t download the Oracle Database 19c base release (LINUX.X64_193000_db_home.zip). I must do that manually and place it in the folder specified by the config file entry folder. I expect the next version to handle it automatically.
$ cd /home/oracle/autoupgrade-patching/patch
$ ls -l
total 2987996
-rw-r--r--. 1 oracle oinstall 3059705302 Mar 18  2020 LINUX.X64_193000_db_home.zip
  1. I need to load my My Oracle Support credentials into the AutoUpgrade keystore so AutoUpgrade can use them to download patches. The first time AutoUpgrade creates the keystore, and I must provide a keystore password:
$ java -jar autoupgrade.jar -config FTEX.cfg -patch -load_password
Processing config file ...

Starting AutoUpgrade Patching Password Loader - Type help for available options
Creating new AutoUpgrade Patching keystore - Password required
Enter password:
Enter password again:
AutoUpgrade Patching keystore was successfully created
  1. I add my credentials. This is the username and password that I use to connect to My Oracle Support:
MOS> add -user daniel.overby.hansen@oracle.com
Enter your secret/Password:
Re-enter your secret/Password:
  1. I save the keystore and convert it to an auto-login keystore:
MOS> save
Convert the AutoUpgrade Patching keystore to auto-login [YES|NO] ? YES
  1. I exit the keystore.
MOS> exit

AutoUpgrade Patching Password Loader finished - Exiting AutoUpgrade Patching

Patch

With one command, I will patch my Oracle Database:

$ java -jar autoupgrade.jar -config FTEX.cfg -patch -mode deploy
AutoUpgrade Patching 24.7.241021 launched with default internal options
Processing config file ...
Loading AutoUpgrade Patching keystore
AutoUpgrade Patching keystore was successfully loaded

Connected to MOS - Searching for specified patches

------------------------------------------------------------
Downloading files to /home/oracle/autoupgrade-patching/patch
------------------------------------------------------------
DATABASE RELEASE UPDATE 19.25.0.0.0
    File: p36912597_190000_Linux-x86-64.zip - VALIDATED

DATAPUMP BUNDLE PATCH 19.25.0.0.0
    File: p37056207_1925000DBRU_Generic.zip - VALIDATED

OJVM RELEASE UPDATE 19.25.0.0.0
    File: p36878697_190000_Linux-x86-64.zip - VALIDATED

OPatch 12.2.0.1.44 for DB 19.0.0.0.0 (Oct 2024)
    File: p6880880_190000_Linux-x86-64.zip - VALIDATED
------------------------------------------------------------

+-----------------------------------------+
| Starting AutoUpgrade Patching execution |
+-----------------------------------------+
1 Non-CDB(s) will be processed
Type 'help' to list console commands
patch> Job 100 completed
------------------- Final Summary --------------------
Number of databases            [ 1 ]

Jobs finished                  [1]
Jobs failed                    [0]
Jobs restored                  [0]
Jobs pending                   [0]

---- Drop GRP at your convenience once you consider it is no longer needed ----
Drop GRP from FTEX: drop restore point AU_PATCHING_9212_FTEX1921000


Please check the summary report at:
/home/oracle/autoupgrade-patching/log/cfgtoollogs/patch/auto/status/status.html
/home/oracle/autoupgrade-patching/log/cfgtoollogs/patch/auto/status/status.log

That’s it! My database is now running on Oracle Database 19.25.0.

Fine Print

AutoUpgrade does out-of-place patching according to our recommendations. It will use a brand-new Oracle home, and copies all configuration files from the old to the new Oracle home.

AutoUpgrade currently requires:

  • Oracle Database 19c
  • Single instance database (non-CDB or entire CDB)

If you need more details, please check out the webinar One-Button Patching with AutoUpgrade. The slide deck has additional details.

What About

This is the first release, and naturally, it comes with restrictions. We’re working hard behind the scenes to lift those requirements.

Will AutoUpgrade support other platforms? Yes. AutoUpgrade supports most of the platforms where you run Oracle Database, including Windows, AIX and SPARCH Solaris.

What about in-place patching, using cloned Oracle homes, and support for gold images? It’s in the plans.

Will you support other Oracle Database releases? Yes – anything newer than Oracle Database 19c

What about Data Guard and RAC? You can use AutoUpgrade for Data Guard. RAC is in the plans.

What about Grid Infrastructure? We’re focusing on Oracle Database. You should have a look at Oracle Fleet Patching and Provisioning.

What about … We’re looking for new, great ideas. Please create an enhancement request in My Oracle Support and send me the number. I’ll check it and add it to our backlog. Feel free to also send me an email with your suggestion.

Happy Patching!

21 thoughts on “How to Patch Oracle Database With One Command

  1. Hi,

    I am running into this error after running the patch deploy command. Could not find information on what exactly failed. Could you please help?

    2024-11-04 17:38:51.220 ERROR Encountered an unexpected runtime exception in PRECHECKS phase of suryacdb: Exception: COM114
    Err message: CommonException [A failed check has an ERROR severity but the fixup is unavailable or failed to correct the problem. Manually fix the problem and rerun AutoUpgrade Patching]

    Thanks,

    Surya

    Like

    1. Hi Surya,

      Would it be possible for you to create a zip package?
      java -jar autoupgrade.jar -config -zip

      If you could upload that to an SR, I will take a look. I’m not fond of exchanging such files in other channels than My Oracle Support.

      Thanks,
      Daniel

      Like

  2. Hi Daniel

    You mentioned that supporting Data Guard is in the plans.

    Does this mean I currently cannot use the “one command” AutoUpgrade to patch my 19.23.0 database, configured with Data Guard, to version 19.25.0? Does this also mean I still have to perform all the manual steps (such as executing OPatch, datapatch, etc.) if I want to continue with a Standby-First Patch Apply approach?

    If so, when can I expect AutoUpgrade to support patching a Data Guard-configured database?

    Regards,
    Jonas

    Like

    1. Hi Jonas,

      The Data Guard project is huge and I currently don’t have any estimate. We’re still early on.

      You should be able to use parts of the new AutoUpgrade Patching even for Data Guard. At least to build the oracle homes using “-mode create_home”. Perhaps you can even do the deploy on the primary database when the standbys have been taken care of manually.

      I need to test this and I plan to write a blog post – when time allows :)

      Thanks for your patience,
      Daniel

      Like

  3. Thank you very much for your quick response. I’ll explore and test the patch functionality in AutoUpgrade. To me, it seems like a significant improvement over our current, partially automated patching process that relies on custom scripts.

    I have a test environment configured with Data Guard, and I’m going to try to create a script to patch both the primary and standby databases using the functionality in AutoUpgrade. It’s not exactly a one-command process, but I can manage :-) .

    If you’d like me to test something specific, please send me a direct message, and I’ll handle it.

    /Jonas

    Like

  4. Hello!

    We are trying to patch our lab host with autoupgrade.jar and received one ignorable Error : autoupgrade.jar swap requirement Error Message:PRVF-7573 : Sufficient swap size is not available on node. It ask to increased swap size to 6 GB, that what we have memory size. Thinking if we will increase to 6 GB and may be after that there will be no Error. But what we will do when we will try to patch our Prod host and memory size there is 300GB? is there any option where we can ignore Prerequisit CHECK on Swap size?

    /Azhar

    Like

    1. Hi Azhar,

      Great that you’re trying the new version of AutoUpgrade. This is a known problem that we’ve already solved (by ignoring certain installer warnings). This will be fixed in the next version of AutoUpgrade. If you want to test the fix, I can get you a test version of AutoUpgrade. If so, please send me an e-mail: daniel.overby.hansen@oracle.com. Otherwise, for now, you need to be able to install the Oracle home with those warnings, so increasing swap space is needed.

      Regards,
      Daniel

      Liked by 1 person

  5. Hi Daniel,

    Thank you for sharing this helpful article. Is it really necessary to include this target_home in the configuration file? If we need to patch in our current home only

    Additionally, we must apply the N-1 patch; if so, is there a specific release we can mention?

    Like

    1. Hi,
      We don’t support in-place patching. Our recommendation is to use out-of-place patching and that’s what we currently support. Thus, you must set target_home.

      If you want to apply a specific RU, you can specify it using:
      .patch=RU:19.24,opatch,ojvm,dpbp

      Regards,
      Daniel

      Liked by 1 person

  6. Hi Daniel,

    question, when more than one database using the same DB OH, there are some limitation for autoupgrade? Or make the Patching only for the first database and the other can be stopped for the old OH and started in the new one ?

    Thank you in advance

    Adrian

    Like

    1. Hi,

      You can use AutoUpgrade to create the new Oracle home and patch one database. Then, when you want to patch the other database(s) from the old home, you just start AutoUpgrade again. It’ll detect the existing Oracle home and if the patches in the new Oracle home matches what you describe in the AutoUpgrade config file, it’ll just proceed patching to the new Oracle home (thus skipping creation of the home, since it already exists).

      Regards,
      Daniel

      Like

  7. Imagen I have already prepared a brand new target ORACLE_HOME with up2date Opatch, RU,OJVM and JDK. I only want to move the databases from the current ORACLE_HOME to the new prepared ORACLE_HOME. Is this possible with autoupgrade ? In other words I don’t want autoupgrade to create a new home and apply all the patches. Just moving the databases to the new ORACLE_HOME.

    Like

    1. Hi,

      You can do that. If you have created the new Oracle home already, it’s really easy with AutoUpgrade. Just specify sid, source and target home in a config file, and hit deploy mode. Check the details in this video:

      Regards,
      Daniel

      Like

  8. The online manual says https://docs.oracle.com/en/database/oracle/oracle-database/23/upgrd/autoupgrade-patching.html#GUID-B4169A36-FA3F-430E-B5FE-E72082D0B6AD :

    A comma-delimited list of the patches that you want to install.

    Note: When method=outofplace is set, then the patch list must include RU,OPATCH

    The default value is RECOMMENDED.

    Supported value:

    RECOMMENDED: Alias for all of the following options: RU, OPATCH, OJVM, DPBP.

    RU: Latest release update

    RU:x.y: A release update (RU) of the specified release version, where x is the major release number, and y is the RU. For example: RU:19:24

    OPATCH: Use latest version of OPatch

    OJVM: Apply the Oracle Java VM patch that applies to the specified RU.

    OJVM:x.y: Apply the Oracle Java VM patch of the specified release version, where x is the major release number, and y is the RU. For example: RU:19.24

    DPBP: Apply the Oracle Data Pump patch for the specified RU

    patch-number: Provide a specific one-off patch number. For example: upg1.patch=p12345678_19.21.0.0.123456

    How is this oneoff-patch applied : p36551493_1926000DBRU_Linux-x86-64.zip ?

    I have this in my config: patch1.patch=RU:19.26,OPATCH,OJVM:19.26,p36551493_1926 and tried a lot of different ones but got still the message:

    Processing config file …The following errors were found in the configuration file:The patch parameter for prefix patch1 includes a value that is not supported or is not in the required format

    How can I apply a one-off patch ?

    Like

      1. Yes…thats working…. Seems Oracle has to modify the online manual…..;-) Since you working for Oracle…the honor is yours.

        Like

Leave a reply to Jonas Göransson Cancel reply

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