Learn to patch the way God intended (S2E1)
A promise is a promise, so we begin the second season of the series of articles «Learn to patch the way God intended».
In case you haven’t already, I recommend you take a look at the previous episodes:
1. How to in-place patching, the most common and also the most dangerous way
2. How to out-of-place patching, the recommended and also the most efficient way
3. Simplifying out-of-place patching using Gold Image
In this new season, we will see more complex cases, starting with: how to patch Oracle RAC?
We will use a 2-node Cluster using Oracle 19c RU25, which we want to upgrade to Oracle 19c RU26.
Starting situation
We have 2 servers: node1 and node2, in which Oracle Database Server 19c with release update 19.25 is installed, in an Oracle Home called DBHome1 which support a database in RAC called orcl.
$ echo ${ORACLE_HOME}
/u01/app/oracle/19.0.0/db_1
$ srvctl status database -db orcl
Instance orcl1 is running on node node1
Instance orcl2 is running on node node2
Gold Image creation
In our scenario, we want to apply RU 19.26, so the patches we will apply are:
37257886 | gi release update 19.26.0.0.0 |
37102264 | ojvm release update 19.26.0.0.0 |
37542054 | jdk bundle patch 19.0.0.0.250415 |
37470729 | datapump bundle patch 19.26.0.0.0 |
37769923 | database mrp 19.26.0.0.250415 |
As the final episode of the first season details the procedure to follow for the creation of a Gold Image, we will not repeat the steps in this episode.
Unlike the case presented there, now it is an Oracle RAC, so we should not use the database release update, but we have to use the gi release update, because it is the one that contains the OCW release update, which is a required patch for Oracle RAC.
$ ${DB_HOME}/runInstaller -silent -printtime \
-waitforcompletion -ignorePrereqFailure \
ORACLE_HOME_NAME="DBTemp" -applyRU ${STAGE}/37257886 \
-applyOneOffs ${STAGE}/37102264,${STAGE}/37542054,${STAGE}/37470729 \
-responseFile ${DB_HOME}/install/response/db_install.rsp \
INVENTORY_LOCATION=/u01/app/oraInventory \
UNIX_GROUP_NAME=oinstall \
ORACLE_BASE=/u01/app/oracle \
oracle.install.option=INSTALL_DB_SWONLY \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSBACKUPDBA_GROUP=backupdba \
oracle.install.db.OSDGDBA_GROUP=dgdba \
oracle.install.db.OSKMDBA_GROUP=kmdba \
oracle.install.db.OSRACDBA_GROUP=racdba \
oracle.install.db.rootconfig.executeRootScript=false
$ opatch napply ${STAGE}/37769923 -oh ${DB_HOME} -silent
$ sudo /u01/app/oracle/19.0.0/db_1/root.sh
$ ${DB_HOME}/runInstaller -silent \
-createGoldImage -destinationLocation \
${STAGE}/goldImages -name db_home_19_26.zip
Oracle RAC out-of-place patching with Gold Image
If you have not done it yet, I recommend you to first read the steps to apply an out-of-place patch, for a better understanding of what is up next, and then come back.
Now that we have a Gold Image, let’s see the procedure to follow to patch Oracle RAC:
Copying from Gold Image
Unzip the patched Oracle Database 19c software, contained in the Gold Image, in the newly created directory.
$ mkdir /u01/app/oracle/19.0.0/db_2
$ export DB_HOME=/u01/app/oracle/19.0.0/db_2
$ export STAGE=/stage
$ unzip -oq ${STAGE}/goldImages/db_home_19_26.zip -d ${DB_HOME}
You must run this on all nodes in your Cluster, and you can do it in parallel.
1
2
Registering the new Oracle Home
We proceed to compile the binaries and register the Oracle Home DBHome2 in the inventory.
$ export NODE=$(hostname)
$ ${DB_HOME}/runInstaller -silent -printtime \
-waitforcompletion -ignorePrereqFailure \
ORACLE_HOME_NAME="DBHome2" \
-responseFile ${DB_HOME}/install/response/db_install.rsp \
INVENTORY_LOCATION=/u01/app/oraInventory \
UNIX_GROUP_NAME=oinstall \
ORACLE_BASE=/u01/app/oracle \
oracle.install.option=INSTALL_DB_SWONLY \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSBACKUPDBA_GROUP=backupdba \
oracle.install.db.OSDGDBA_GROUP=dgdba \
oracle.install.db.OSKMDBA_GROUP=kmdba \
oracle.install.db.OSRACDBA_GROUP=racdba \
oracle.install.db.CLUSTER_NODES=${NODE} \
oracle.install.db.rootconfig.executeRootScript=false
$ sudo /u01/app/oracle/19.0.0/db_2/root.sh
You must run this on all nodes in your Cluster, and you can do it in parallel.
After this, we have the Oracle Home DBHome2, which contains the Oracle Database 19.26 binaries.
Service shutdown - node1
To use the new OH, it is mandatory to shutdown the instances as a first step.
Since this is Oracle RAC, the database is never stopped; what is needed is to restart the database instance by instance, until there is none left using the old OH.
We will begin with node1:
[oracle@node1]
$ export ORACLE_HOME=/u01/app/oracle/19.0.0/db_1
$ export PATH=$ORACLE_HOME/bin:$PATH
$ export ORACLE_SID=orcl1
$ sqlplus / as sysdba
SQL> shutdown immediate
3
4
Restart of service - node1
Before restarting the instance, you must first register the new OH linked to the database orcl.
[oracle@node1]
$ srvctl modify database -db orcl -oraclehome /u01/app/oracle/19.0.0/db_2
$ srvctl start instance -db orcl -instance orcl1
At this stage, we have the orcl1 instance operating with the new OH and the orcl2 instance operating with the old OH.
Service shutdown - node2
And finally, it is the turn of node2:
[oracle@node2]
$ export ORACLE_HOME=/u01/app/oracle/19.0.0/db_1
$ export PATH=$ORACLE_HOME/bin:$PATH
$ export ORACLE_SID=orcl2
$ sqlplus / as sysdba
SQL> shutdown immediate
5
6
Restart of service - node2
[oracle@node2]
$ srvctl start instance -db orcl -instance orcl2
At this moment, we have all instances running with the new OH.
Database patching
We update the environment variables to reference the new OH, and then we can continue with the patching of the database catalog, using the datapatch utility.
This is executed only once, from any Oracle RAC node; in our case, we will do it from node1.
$ export ORACLE_HOME=/u01/app/oracle/19.0.0/db_2
$ export PATH=$ORACLE_HOME/bin:$PATH
$ export ORACLE_SID=orcl1
$ ${ORACLE_HOME/OPatch/datapatch -verbose
7
Conclusion
In a few minutes we have the database operating from the new Oracle Home DBHome2 and, as you may have noticed, it was not that difficult.
At this time, and after all that we have done, we confirm again that out-of-place patching with Gold Image is the winning combination: minimum software setup time and minimum service downtime.
In the next episode we will see how to use out-of-place patching but now for Oracle Grid Infrastructure, so stay tuned!
Recent Posts





