Let me show you how I patch Oracle Restart and Oracle Database 19c using the out-of-place method by switching to the new Oracle homes.
The advantages of this solution:
- I get more control over the process
- I can perform the entire operation with just one database restart
- I can create my Oracle homes using gold images
- I can prepare the new Oracle homes in advance
- Overall, I find this method less riskier
My demo system
- Single instance database in Oracle Restart configuration
- Runs Oracle Linux
- GI and database home are currently on 19.24
I want to:
- patch to 19.25
- patch both the GI and database home in one operation
Preparation
I need to download:
- The base releases of:
- Oracle Grid Infrastructure (LINUX.X64_193000_grid_home.zip)
- Oracle Database (LINUX.X64_193000_db_home.zip)
- Latest OPatch from My Oracle Support (6880880).
- Patches from My Oracle Support:
- 19.25 Release Update for Grid Infrastructure (36916690)
- Matching OJVM bundle patch (36878697)
- Matching Data Pump bundle patch (36682332)
You can use AutoUpgrade to easily download GI patches.
I place the software in /u01/software.
How to Patch Oracle Restart 19c and Oracle Database
1. Prepare a New GI Home
I can do this in advance. It doesn’t affect my current environment and doesn’t cause any downtime.
-
I need to create a folder for the new GI home. I must do this as root:
[root@node1]$ mkdir -p /u01/app/19.25.0/grid
[root@node1]$ chown -R grid:oinstall /u01/app/19.25.0
[root@node1]$ chmod -R 775 /u01/app/19.25.0
-
I switch to the GI home owner, grid.
-
I extract the base release of Oracle Grid Infrastructure into the new GI home:
[grid@node1]$ export OLDGRIDHOME=$ORACLE_HOME
[grid@node1]$ export NEWGRIDHOME=/u01/app/19.25.0/grid
[grid@node1]$ cd $NEWGRIDHOME
[grid@node1]$ unzip -oq /u01/software/LINUX.X64_193000_grid_home.zip
Optionally, I can use a golden image.
-
I update OPatch to the latest version:
[grid@node1]$ cd $NEWGRIDHOME
[grid@node1]$ rm -rf OPatch
[grid@node1]$ unzip -oq /u01/software/p6880880_190000_Linux-x86-64.zip
-
Then, I check the Oracle Grid Infrastructure prerequisites. I am good to go if the check doesn’t write any error messages to the console:
[grid@node1]$ export ORACLE_HOME=$NEWGRIDHOME
[grid@node1]$ $ORACLE_HOME/gridSetup.sh -executePrereqs -silent
-
I want to apply the 19.25 Release Update while I install the GI home. To do that, I must extract the patch file:
[grid@node1]$ cd /u01/software
[grid@node1]$ unzip -oq p36916690_190000_Linux-x86-64.zip -d 36916690
- The GI Release Update is a bundle patch consisting of:
- OCW Release Update (patch 36917416)
- Database Release Update (36912597)
- ACFS Release Update (36917397)
- Tomcat Release Update (36940756)
- DBWLM Release Update (36758186)
- I will apply all of them.
-
Finally, I can install the new GI home:
- The parameter
-applyRU is the path to the OCW Release Update.
- The parameter
-applyOneOffs is a comma-separated list of the paths to each of the other Release Updates in the GI bundle patch.
- The environment variable
CLUSTER_NAME is the name of my Oracle Restart stack.
[grid@node1]$ export ORACLE_BASE=/u01/app/grid
[grid@node1]$ export ORA_INVENTORY=/u01/app/oraInventory
[grid@node1]$ export ORACLE_HOME=$NEWGRIDHOME
[grid@node1]$ cd $ORACLE_HOME
[grid@node1]$ ./gridSetup.sh -ignorePrereq -waitforcompletion -silent \
-applyRU /u01/software/36916690/36916690/36917416 \
-applyOneOffs /u01/software/36916690/36916690/36912597,/u01/software/36916690/36916690/36917397,/u01/software/36916690/36916690/36940756,/u01/software/36916690/36916690/36758186 \ \
-responseFile $ORACLE_HOME/install/response/gridsetup.rsp \
INVENTORY_LOCATION=$ORA_INVENTORY \
ORACLE_BASE=$ORACLE_BASE \
SELECTED_LANGUAGES=en \
oracle.install.option=CRS_SWONLY \
oracle.install.asm.OSDBA=asmdba \
oracle.install.asm.OSOPER=asmoper \
oracle.install.asm.OSASM=asmadmin \
oracle.install.crs.config.ClusterConfiguration=STANDALONE \
oracle.install.crs.config.configureAsExtendedCluster=false \oracle.install.crs.config.gpnp.configureGNS=false \
oracle.install.crs.config.autoConfigureClusterNodeVIP=false
- Although the script says so, I don’t run
root.sh.
- I install it in silent mode, but I could use the wizard instead.
- You need to install the new GI home in a way that matches your environment.
- For inspiration, you can check the response file used in the previous GI home on setting the various parameters.
- If I have additional one-off patches to install, I add them to the comma-separated list.
2. Prepare a New Database Home
I can do this in advance. It doesn’t affect my current environment and doesn’t cause any downtime.
-
I need to create a folder for the new database home. I must do this as oracle:
[oracle@node1]$ export NEW_ORACLE_HOME=/u01/app/oracle/product/dbhome_1925
[oracle@node1]$ mkdir -p $NEW_ORACLE_HOME
-
I extract the base release of Oracle Database into the new database home:
[oracle@node1]$ cd $NEW_ORACLE_HOME
[oracle@node1]$ unzip -oq /u01/software/LINUX.X64_193000_db_home.zip
Optionally, I can use a golden image.
-
I update OPatch to the latest version:
[oracle@node1]$ rm -rf OPatch
[oracle@node1]$ unzip -oq /u01/software/p6880880_190000_Linux-x86-64.zip
-
I want to apply the 19.25 Database Release Update. In addition, I must also apply the OCW Release Update to the database home. I take those from the GI Release Update that I used earlier. In addition, I want to apply the OJVM and Data Pump bundle patches. Those I must extract.
[oracle@node1]$ cd /u01/software
[oracle@node1]$ unzip -oq p36878697_190000_Linux-x86-64.zip -d 36878697
[oracle@node1]$ unzip -oq p37056207_1925000DBRU_Generic_1925.zip -d 37056207
-
Then, I can install the new database home and apply the patches at the same time:
- The parameter
-applyRU is the path to the Database Release Update.
- The parameter
-applyOneOffs is a comma-separated list of the paths to the OCW Release Update plus OJVM and Data Pump bundle patches.
[oracle@node1]$ export ORACLE_BASE=/u01/app/grid
[oracle@node1]$ export ORA_INVENTORY=/u01/app/oraInventory
[oracle@node1]$ export OLD_ORACLE_HOME=$ORACLE_HOME
[oracle@node1]$ export ORACLE_HOME=$NEW_ORACLE_HOME
[oracle@node1]$ cd $ORACLE_HOME
[oracle@node1]$ ./runInstaller -ignorePrereqFailure -waitforcompletion -silent \
-responseFile $ORACLE_HOME/install/response/db_install.rsp \
-applyRU /u01/software/36916690/36916690/36912597 \
-applyOneOffs /u01/software/36916690/36916690/36917416,/u01/software/36878697/36878697,/u01/software/37056207/37056207 \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=$ORA_INVENTORY \
SELECTED_LANGUAGES=en \
ORACLE_HOME=$ORACLE_HOME \
ORACLE_BASE=$ORACLE_BASE \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
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.isRACOneInstall=false \
oracle.install.db.rac.serverpoolCardinality=0 \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true
- I install it in silent mode, but I could use the wizard instead.
- You need to install the new database home in a way that matches your environment.
- For inspiration, you can check the response file used in the previous database home on setting the various parameters.
- If I have additional one-off patches to install, I add them to the comma-separated list.
-
I run the database root script:
[root@node1]$ $NEW_ORACLE_HOME/root.sh
- I run just the database root script. Not the GI root script.
3. Prepare Database
I can do this in advance. It doesn’t affect my current environment and doesn’t cause any downtime.
I will move the database into a new Oracle home, so I need to ensure the database configuration files are either outside the Oracle home or move them to the new Oracle home.
- I verify that my SP file and password file are stored in ASM – or at least outside the Oracle home:
[oracle@node1]$ export ORACLE_HOME=$OLD_ORACLE_HOME
[oracle@node1]$ srvctl config database -db $ORACLE_UNQNAME | grep file
- If the files are stored in the dbs folder, I copy them to new Oracle home.
- I copy
tnsnames.ora and sqlnet.ora to the new Oracle home:[oracle@node1]$ cp $OLD_ORACLE_HOME/network/admin/sqlnet.ora $NEW_ORACLE_HOME/network/admin
[oracle@node1]$ cp $OLD_ORACLE_HOME/network/admin/tnsnames.ora $NEW_ORACLE_HOME/network/admin
- I take care of any other configuration files in the Oracle home.
- I modify the database so it starts in the new Oracle home on the next restart.
[oracle@node1]$ srvctl modify database -d $ORACLE_UNQNAME -o $NEW_ORACLE_HOME
4. Switch to the New GI and Database Homes
Now, I can complete the patching process by switching to the new Oracle homes.
-
I connect as root and start the switch:
[root@node1]$ export ORACLE_HOME=/u01/app/19.25.0/grid
[root@node1]$ $ORACLE_HOME/rdbms/install/rootadd_rdbms.sh
[root@node1]$ $ORACLE_HOME/crs/install/roothas.sh -prepatch -dstcrshome $ORACLE_HOME
-
Downtime starts now!
-
Then, I complete the switch.
- This step stops the entire GI stack, including resources it manages (databases, listener, etc.).
- Everything is restarted in the new Oracle homes.
[root@node1]$ $ORACLE_HOME/crs/install/roothas.sh -postpatch -dstcrshome $ORACLE_HOME
-
Downtime ends now. Users may connect to the database.
-
As grid, I update the inventory, so the new GI home is registered as the active one:
[grid@node1]$ export OLD_ORACLE_HOME=/u01/app/19.24.0/grid
[grid@node1]$ export NEW_ORACLE_HOME=/u01/app/19.25.0/grid
[grid@node1]$ $NEW_ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$NEW_ORACLE_HOME CRS=TRUE
[grid@node1]$ $OLD_ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$OLD_ORACLE_HOME CRS=FALSE
-
I update any profiles (e.g., .bash_profile) and other scripts referring to the GI home.
-
As oracle, I update any profiles (e.g., .bash_profile) and other scripts referring to the database home.
5. Complete Patching
- I complete patching of the database by running Datapatch (ensure the environment is set correctly):
[oracle@node1]$ env | grep ORA
[oracle@node1]$ $ORACLE_HOME/OPatch/datapatch
Most likely, there are other changes that you need to make in your own environment:
- Update Enterprise Manager registration
- Upgrade RMAN catalog
- Update other scripts
- Update
/etc/oratab
That’s it! I have now patched my Oracle Restart deployment.
Happy Patching!
Appendix
Deinstall
In the future, I should remove the old Oracle homes. I use the deinstall tool in the respective Oracle homes.
I would recommend waiting a week or two until I’m confident the new Release Updates are fine.
CRS-0245: User doesn’t have enough privilege to perform the operation
- If you get the following error:
[oracle@node1]$ srvctl modify database -d $ORACLE_UNQNAME -o $NEW_ORACLE_HOME
PRCD-1163 : Failed to modify database DB19
PRCR-1071 : Failed to register or update resource ora.db19.db
CRS-0245: User doesn't have enough privilege to perform the operation
- Be sure to include patch 29326865 in GI and database home.
- Run the
srvctl modify database command as grid instead.
- Be sure that the Oracle user is still set to oracle after running the command as grid:
[oracle@node1]$ srvctl config database -db $ORACLE_UNQNAME | grep user
Rollback
If you need to roll back, you more or less reverse the process. The switch home method works to a newer and lower patch level.
OCW Release Update
Thanks to Jan for commenting on the blog post. The initial version didn’t include the OCW Release Update into the database home, which is needed when the database is managed by Grid Infrastructure in any way.
Incorrect Information in ocr.loc
In the ocr.loc file for Oracle Restart, only the local_only property is used. All other properties can be ignored (like ocrconfig_loc).
In Oracle Database 23ai, the file will be cleaner in Oracle Restart. But for Oracle Database 19c there will be these superfluous properties.
Further Reading
Other Blog Posts in This Series