Yes, the answer is positive.
Usually, we patch Oracle home with one or more existing databases for routine software updates. However, for a new database server which requires up-to-date release of Oracle database software, we can patch Oracle home first, then create the database afterwards by using dbca.
Let's see the procedure.
- Unzip Installation Package
- Install Oracle software only
- Install Newest OPatch
- Patch Oracle home
- Network Configuration Assistant (Optional)
- Database Creation Assistant
We unzip the installation package to any place in the file system.
The command is runInstaller.
Just replace OPatch with the newest one.
The command is opatch apply. Please note that, SQL patch (datapatch -verbose) is unnecessary in this procedure.
The command is netca.
The command is dbca.
For 18c and Later Releases
Starting from 18c, the installation package becomes an image-based one. We can apply patches (Database Release Update, DBRU) during an Oracle Database installation.
Let's see the simplified procedure.
- Unzip Installation Package
- Install Newest OPatch
- Patch Oracle home + Install Oracle software only
- Network Configuration Assistant (Optional)
- Database Creation Assistant
We unzip the installation package to Oracle home, can't go anywhere else.
Just replace OPatch with the newest one.
The command is runInstaller -applyRU.
The command is netca.
The command is dbca.
The differences are, we have to replace OPatch with the newest one (Step 2) before patching and installing Oracle home (Step 3). Furthermore, we reduce 1 step from the original procedure. It's pretty convenient for DBA to setup a new server.
runInstaller -applyRU
The tip is to add -applyRU option to make OUI patch Oracle home to the newest release as well. Here's an example.
[oracle@test ~]$ cd $ORACLE_HOME
[oracle@test dbhome_1]$ ./runInstaller -applyRU /sources/patches/34765931/
Preparing the home to patch...
Applying the patch /sources/patches/34765931/...
Successfully applied the patch.
...
In this case, p34765931 is DBRU 19.18.
Although using -applyRU option is convenient and worthy, the overall time consumed is nearly the same.
Silent Mode
Previously, we have talked about how to install Oracle home in silent mode. What about patch Oracle software in silent mode?
The same tip applies to it. Let's see the example:
[oracle@test dbhome_1]$ ./runInstaller -applyRU /sources/patches/34765931/ -silent -noconfig -ignorePreReq oracle.installer.ignorePreReq=TRUE oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=dba oracle.install.db.OSDGDBA_GROUP=dba oracle.install.db.OSKMDBA_GROUP=dba oracle.install.db.OSRACDBA_GROUP=dba oracle.install.db.rootconfig.executeRootScript=true oracle.install.db.rootconfig.configMethod=ROOT
Software Patched Level
To check the patch level of Oracle software after installation and patching, we use opatch lspatches.
[oracle@test dbhome_1]$ opatch lspatches
34765931;DATABASE RELEASE UPDATE : 19.18.0.0.230117 (REL-JAN230131) (34765931)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
OPatch succeeded.
As you can see, the result of listing patch history is the same as the original procedure. There're 2 patches in 1 install, that's why I said 19.3 installer package for download is also a base + release update one.
Now you can create a new database with the patched Oracle home.
SQL Patched Level
After a new database has been created, we can check its SQL patch level by querying DBA_REGISTRY_SQLPATCH.
SQL> select description from dba_registry_sqlpatch order by action_time desc;
DESCRIPTION
--------------------------------------------------------------------------------
DATABASE RELEASE UPDATE : 19.18.0.0.230117 (REL-JAN230131) (34765931)
It keeps only the very last record, no footprint of 19.3. That's the difference.
To see a good example of patching Oracle home before creating a database, you may refer to the post: How to Install Oracle Database 19.18 on Linux. In the example, we directly install Oracle 19.18 for the new database server.