Let me show you how I patch Oracle Grid Infrastructure 19c (GI) using the out-of-place method and the -switchGridHome
parameter.
My demo system:
- Is a 2-node RAC
- Runs Oracle Linux
- Is currently on 19.16.0, and I want to patch to 19.17.0
- Uses grid as the owner of the software
I patch only the GI home. If I want to patch the database as well, I must do it separately.
Preparation
I need to download:
- Download the base release of Oracle Grid Infrastructure (LINUX.X64_193000_grid_home.zip) from oracle.com or Oracle Software Delivery Cloud.
- Latest OPatch from My Oracle Support (6880880).
- The 19.17.0 Release Update for Oracle Grid Infrastructure from My Oracle Support. I will use the combo patch (34449117).
I place the software in /u01/software.
How to Patch Oracle Grid Infrastructure 19c
1. Prepare a New Grid 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 Grid Home. I must do this as root on all nodes in my cluster (copenhagen1 and copenhagen 2):
[root@copenhagen1]$ mkdir -p /u01/app/19.17.0/grid [root@copenhagen1]$ chown -R grid:oinstall /u01/app/19.17.0 [root@copenhagen1]$ chmod -R 775 /u01/app/19.17.0 [root@copenhagen2]$ mkdir -p /u01/app/19.17.0/grid [root@copenhagen2]$ chown -R grid:oinstall /u01/app/19.17.0 [root@copenhagen2]$ chmod -R 775 /u01/app/19.17.0
-
I switch to the Grid Home owner, grid.
-
I ensure that there is passwordless SSH access between all the cluster nodes. It is a requirement for the installation, but sometimes it is disabled to strengthen security:
[grid@copenhagen1]$ ssh copenhagen2 date [grid@copenhagen2]$ ssh copenhagen1 date
-
I extract the base release of Oracle Grid Infrastructure into the new Grid Home. I work on one node only:
[grid@copenhagen1]$ export NEWGRIDHOME=/u01/app/19.17.0/grid [grid@copenhagen1]$ cd $NEWGRIDHOME [grid@copenhagen1]$ unzip -oq /u01/software/LINUX.X64_193000_grid_home.zip
-
I update OPatch to the latest version:
[grid@copenhagen1]$ cd $NEWGRIDHOME [grid@copenhagen1]$ rm -rf OPatch [grid@copenhagen1]$ 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@copenhagen1]$ export ORACLE_HOME=$NEWGRIDHOME [grid@copenhagen1]$ $ORACLE_HOME/gridSetup.sh -executePrereqs -silent
-
I want to apply the 19.17.0 Release Update while I install the Grid Home. To do that, I must extract the patch file:
[grid@copenhagen1]$ cd /u01/software [grid@copenhagen1]$ mkdir 34449117 [grid@copenhagen1]$ mv p34449117_190000_Linux-x86-64.zip 34449117 [grid@copenhagen1]$ cd 34449117 [grid@copenhagen1]$ unzip p34449117_190000_Linux-x86-64.zip
-
Finally, I can install the new Grid Home:
- I need to update the environment variables.
CLUSTER_NODES
is a comma-separated list of all the nodes in my cluster.- The parameter
-applyRU
must point to the directory holding the GI Release Update. Since I am using the combo patch, I need to specify the subdirectory containing the GI Release Update
[grid@copenhagen1]$ export ORACLE_BASE=/u01/app/grid [grid@copenhagen1]$ export ORA_INVENTORY=/u01/app/oraInventory [grid@copenhagen1]$ export CLUSTER_NAME=$(olsnodes -c) [grid@copenhagen1]$ export CLUSTER_NODES=$(olsnodes | tr '\n' ','| sed 's/,\s*$//') [grid@copenhagen1]$ cd $ORACLE_HOME [grid@copenhagen1]$ ./gridSetup.sh -ignorePrereq -waitforcompletion -silent \ -applyRU /u01/software/34449117/34449117/34416665 \ -responseFile $ORACLE_HOME/install/response/gridsetup.rsp \ INVENTORY_LOCATION=$ORA_INVENTORY \ ORACLE_BASE=$ORACLE_BASE \ SELECTED_LANGUAGES=en,en_GB \ 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.clusterName=$CLUSTER_NAME \ oracle.install.crs.config.gpnp.configureGNS=false \ oracle.install.crs.config.autoConfigureClusterNodeVIP=false \ oracle.install.crs.config.clusterNodes=$CLUSTER_NODES
- Although the script says so, I don’t run root.sh yet.
- I install it in silent mode, but I could use the wizard instead.
- For inspiration, you can check the response file used in the previous Grid Home on setting the various parameters.
- If I have one-off patches to install, I can use the
-applyOneOffs
parameter.
2. Switch to the new Grid Home
Now, I can complete the patching process by switching to the new Grid Home. I do this one node at a time. Step 2 involves downtime.
- First, on copenhagen1, I switch to the new Grid Home:
[grid@copenhagen1]$ export ORACLE_HOME=/u01/app/19.17.0/grid [grid@copenhagen1]$ export CURRENT_NODE=$(hostname) [grid@copenhagen1]$ $ORACLE_HOME/gridSetup.sh \ -silent -switchGridHome \ oracle.install.option=CRS_SWONLY \ ORACLE_HOME=$ORACLE_HOME \ oracle.install.crs.config.clusterNodes=$CURRENT_NODE \ oracle.install.crs.rootconfig.executeRootScript=false
- Then, I run the root.sh script as root:
- This step restarts the entire GI stack, including resources it manages (databases, listener, etc.). This means downtime on this node only. The remaining nodes stay up.
- In that period, GI marks the services as OFFLINE so users can connect to other nodes.
- If my database listener runs out of the Grid Home, GI will move it to the new Grid Home, including copying listener.ora.
- Optionally, if I want a more graceful approach, I can manually stop the services, and perform draining.
- In the end, GI restarts the resources (databases and the like).
[root@copenhagen1]$ /u01/app/19.17.0/grid/root.sh
- I update any profiles (e.g.,
.bashrc
) and other scripts referring to the Grid Home. - I connect to the other node, copenhagen2, and repeat steps 1-3. I double-check that the
CURRENT_NODE
environment variable gets updated to copenhagen2.
That’s it! I have now patched my Grid Infrastructure deployment.
Later on, I can patch my databases as well.
A Word about the Directory for the New Grid Home
Be careful when choosing a location for the new Grid Home. The documentation lists some requirements you should be aware of.
In my demo environment, the existing Grid Home is:
/u01/app/19.0.0.0/grid
Since I am patching to 19.17.0, I think it makes sense to use:
/u01/app/19.17.0/grid
If your organization has a different naming standard, that’s fine. Just ensure you comply with the requirements specified in the documentation.
Don’t Forget to Clean Your Room
At a future point, I need to remove the old Grid Home. I use the deinstall tool in the Grid Home. I execute the command on all nodes in my cluster:
$ export OLD_GRID_HOME=/u01/app/19.0.0.0/grid
$ export ORACLE_HOME=OLD_GRID_HOME
$ $ORACLE_HOME/deinstall/deinstall -local
I will wait until:
- I have seen the new Grid Home run without problems for a week or two.
- I have patched my Oracle Databases managed by GI.
- I have seen my Oracle Databases run without GI-related problems for a week or two.
Happy Patching!
Appendix
Other Blog Posts in This Series
- Introduction
- How to Patch Oracle Grid Infrastructure 19c Using In-Place OPatchAuto
- How to Patch Oracle Grid Infrastructure 19c Using Out-Of-Place OPatchAuto
- How to Patch Oracle Grid Infrastructure 19c Using Out-Of-Place SwitchGridHome
- How to Patch Oracle Grid Infrastructure 19c Using Zero Downtime Oracle Grid Infrastructure Patching
- Which Method Should I Choose When Patching Oracle Grid Infrastructure 19c
- How to Avoid Interruptions When You Patch Oracle Grid Infrastructure 19c
- Patching Oracle Grid Infrastructure And Oracle Data Guard
- Use Cluster Verification Utility (cluvfy) and Avoid Surprises
- A Word about Zero Downtime Oracle Grid Infrastructure Patching
- Why You Need to Use Oracle Fleet Patching and Provisioning
- My Best Advice on Patching Oracle Grid Infrastructure
- Pro Tips