Using autoupgrade to create a new ORACLE_HOME

The installation of Oracle software is sometimes a bit tedious. Especially if you have to download all the latest patches (Datapump, OJVM, RU, OPatch). Thanks to the latest update of autoupgrade it is way easier to download all these patches for a platform. The full process is very well described in this blog post by Rodrigo Jorge: https://www.dbarj.com.br/en/2024/11/downloading-oracle-patches-using-cli-with-autoupgrade-patching/

Currently only the patches will be downloaded, to create a home you have to have the base image in place:

-rwxr-xr-x 1 oracle oinstall 3059705302 Nov 13 09:39 LINUX.X64_193000_db_home.zip

With this feature autoupgrade is also able to create a new home and patch your databases on this server. A great invention for this tool!

The question is, can we use this tool (AutoUpgrade Tool (Doc ID 2485457.1)) to create an Oracle Home on a server without an existing database?

The answer is Yes, with some tweaks.

Preparing the server

For the download not much is required. But for the creation of the Oracle Home and patch this home the autoupgrade tool is checking some things in advance. If we start the autoupgrade with the “-mode create_home” parameter with this config file (same as for download), it will fail immediately:

global.global_log_dir=/u01/install/log
global.keystore=/u01/install/wallet

patch1.target_home=/u01/app/oracle/product/19/rdbms1925
patch1.folder=/u01/install
patch1.patch=RU,OPATCH,OJVM,DPBP
patch1.target_version=19

We’ll get the following output if we start:

[oracle@autoupgrade01 install]$  java -jar autoupgrade.jar -config home_creation.cfg -patch -mode create_home
AutoUpgrade Patching 24.7.241021 launched with default internal options
Processing config file ...
patch1
patch1.source_home has no value defined in the user configuration file and it is a mandatory parameter

As the last line states we need at least the parameter source_home defined. Oracle is checking some files in this directory therefore I create a temporary directory to which I point this parameter and will place the required files in.

global.global_log_dir=/u01/install/log
global.keystore=/u01/install/wallet

patch1.source_home=/u01/install/tmp

patch1.target_home=/u01/app/oracle/product/19/rdbms1925
patch1.sid=DB19
patch1.folder=/u01/install
patch1.patch=RU,OPATCH,OJVM,DPBP
patch1.target_version=19

Now the installer starts but will fail very fast:

[oracle@autoupgrade01 install]$  java -jar autoupgrade.jar -config home_creation.cfg -patch -mode create_home
AutoUpgrade Patching 24.7.241021 launched with default internal options
Processing config file ...
Loading AutoUpgrade Patching keystore
AutoUpgrade Patching keystore was successfully loaded
-------------------------------------------------
Errors in database [create_home_1]
Stage     [INSTALL]
Operation [STOPPED]
Status    [ERROR]
Info    [Exception: COM103
Err message: CommonException [Unable to read file [/etc/oraInst.loc]]
oracle.commons.utils.errors.COM103: CommonException [Unable to read file [/etc/oraInst.loc]]
        at oracle.commons.helpers.Utilities.readFile(Utilities.java:521)
        at oracle.patch.dispatcher.actions.OracleInstallDetails.<init>(RunInstaller.java:172)
        at oracle.patch.dispatcher.actions.RunInstaller.runInstaller(RunInstaller.java:93)
        at oracle.patch.dispatcher.actions.RunInstaller.executePatchStage(RunInstaller.java:85)
        at oracle.patch.dispatcher.def.PatchJobAction.executeStage(PatchJobAction.java:75)
        at oracle.commons.dispatcher.JobStage.executeStage(JobStage.java:80)
        at oracle.patch.dispatcher.def.PatchJobStage.executeStage(PatchJobStage.java:67)
        at oracle.commons.dispatcher.RunJobDefinition.runJob(RunJobDefinition.java:144)
        at oracle.patch.dispatcher.def.RunAutoPatchJob.runJob(RunAutoPatchJob.java:61)
        at oracle.patch.dispatcher.AutoPatchJobThread.run_(AutoPatchJobThread.java:118)
        at oracle.patch.dispatcher.AutoPatchJobThread.run(AutoPatchJobThread.java:107)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.nio.file.NoSuchFileException: /etc/oraInst.loc
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
        at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:422)
        at java.base/java.nio.file.Files.readAllBytes(Files.java:3206)
        at oracle.commons.helpers.Utilities.readFile(Utilities.java:519)
        ... 16 more
]

As you can see, we need the file /etc/oraInst.loc with the following content:

inventory_loc=/u01/app/oraInventory
inst_group=oinstal

Unfortunately this is not enough. As mentioned Oracle is checking the Edition of already installed Oracle Home and also checking for the ORACLE_BASE patch. To avoid additional errors we have to copy some files to the “temporary home” directory. This directory will look like this afterwards:

.
├── bin
│   ├── orabase
│   └── oraversion
├── install
│   └── orabasetab
└── lib
    ├── libedtn19.a
    └── libedtn19_ent.a

The orabase and oraversion files are used to determine the version of the installed home, I assume that the two libraries are used to check for the installed edition.

The file install/orabasetab is used to determine the location of ORACLE_BASE for this installation and needs to be adapted as follows:

[oracle@autoupgrade01 tmp]$ cat install/orabasetab
#orabasetab file is used to track Oracle Home associated with Oracle Base
/u01/install/tmp:/u01/app/oracle:RDBMS1923:N:

Creation of the ORACLE_HOME

As soon as we have the oraInst.loc as well as the tmp directory created and also the BASE Image and the patches downloaded (as described in the blog post mentioned above) we can start the creation of the ORACLE_HOME. After I got the “patch>” prompt I’m monitoring the process with “lsj -a 10” (repeat every 10s).

[oracle@autoupgrade01 install]$  java -jar autoupgrade.jar -config home_creation.cfg -patch -mode create_home
Previous execution found loading latest data
Total jobs recovered: 1
Loading AutoUpgrade Patching keystore
AutoUpgrade Patching keystore was successfully loaded
+-----------------------------------------+
| Starting AutoUpgrade Patching execution |
+-----------------------------------------+
Type 'help' to list console commands
patch> lsj -a 10
patch>  +----+-------------+-------+---------+-------+----------+-------+---------------------+
|Job#|      DB_NAME|  STAGE|OPERATION| STATUS|START_TIME|UPDATED|              MESSAGE|
+----+-------------+-------+---------+-------+----------+-------+---------------------+
| 100|create_home_1|EXTRACT|EXECUTING|RUNNING|  11:04:47| 5s ago|Extracting gold image|
+----+-------------+-------+---------+-------+----------+-------+---------------------+
...

+----+-------------+-------+---------+-------+----------+-------+----------------------+
|Job#|      DB_NAME|  STAGE|OPERATION| STATUS|START_TIME|UPDATED|               MESSAGE|
+----+-------------+-------+---------+-------+----------+-------+----------------------+
| 100|create_home_1|INSTALL|EXECUTING|RUNNING|  11:04:47| 3s ago|Installing ORACLE_HOME|
+----+-------------+-------+---------+-------+----------+-------+----------------------+
Total jobs 1
...
+----+-------------+------+---------+-------+----------+-------+----------------------------------------+
|Job#|      DB_NAME| STAGE|OPERATION| STATUS|START_TIME|UPDATED|                                 MESSAGE|
+----+-------------+------+---------+-------+----------+-------+----------------------------------------+
| 100|create_home_1|OPATCH|EXECUTING|RUNNING|  11:06:56| 7s ago|Database Release Update : 19.25.0.0.2410|
+----+-------------+------+---------+-------+----------+-------+----------------------------------------+
...
+----+-------------+------+---------+-------+----------+-------+---------------------------------+
|Job#|      DB_NAME| STAGE|OPERATION| STATUS|START_TIME|UPDATED|                          MESSAGE|
+----+-------------+------+---------+-------+----------+-------+---------------------------------+
| 100|create_home_1|OPATCH|EXECUTING|RUNNING|  11:06:56| 6s ago|DATAPUMP BUNDLE PATCH 19.25.0.0.0|
+----+-------------+------+---------+-------+----------+-------+---------------------------------+
...
+----+-------------+------+---------+-------+----------+-------+----------------------------------------+
|Job#|      DB_NAME| STAGE|OPERATION| STATUS|START_TIME|UPDATED|                                 MESSAGE|
+----+-------------+------+---------+-------+----------+-------+----------------------------------------+
| 100|create_home_1|OPATCH|EXECUTING|RUNNING|  11:06:56|68s ago|OJVM RELEASE UPDATE: 19.25.0.0.241015 (3|
+----+-------------+------+---------+-------+----------+-------+----------------------------------------+
Total jobs 1

The command lsj is running every 10 seconds. PRESS ENTER TO EXIT
Job 100 completed
------------------- Final Summary --------------------
Number of databases            [ 1 ]

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



Please check the summary report at:
/u01/install/log/cfgtoollogs/patch/auto/status/status.html
/u01/install/log/cfgtoollogs/patch/auto/status/status.log
[oracle@autoupgrade01 install]$

The full process of creating the home and patch the home (datapump, OJVM, RU) took around 6min on my lab machine.

Conclusion

We can create an ORACLE_HOME on a server without any Oracle Software to the latest patch level within minutes and one command.

We need some preparation for this and some files created:

  • /etc/oraInst.loc
  • “temp home” with the following files
    • bin/orabase
    • bin/oraversion
    • install/orabasetab
    • lib/libedtn19.a
    • lib/libedtn19_ent.a
  • LINUX.X64_193000_db_home.zip

And before we start autoupgrade with “create_home” we download the latest patches with “download”.

2 Replies to “Using autoupgrade to create a new ORACLE_HOME”

  1. Great catch! The next releases of AU may break this workaround as we will also clone other properties from some other libs like the binary enabled features.
    Anyway, we plan to have an enhancement in the future where you can provide what you want on the new created home via parameters instead of cloning from the source home.

    1. Thanks and I assumed that this will only work for a specific version (24.7.241021) or at least needs some adaption for further releases. Great to read that this is planed for a future release.
      Again, great work with the tool!

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.