Sunday, 4 February 2024

A Guide : Patch Oracle 19c Grid Infrastructure

   To patch Oracle Grid Infrastructure 19c, follow these detailed steps. This guide assumes you have already downloaded and unzipped the necessary patch files.

Prerequisites


        Backup: Always ensure you have a recent backup of your database and Grid Infrastructure.
        Environment Setup: Verify that ORACLE_HOME is set correctly for the Grid Infrastructure home.


Step-by-Step Patching Guide


1. Verify the Patch Contents
Navigate to the directory where you have unzipped the patch files and list the contents, always verify the contents of directory before proceeding with further steps.


2. Check for Patch Conflicts
Run conflict checks for each patch to ensure there are no conflicts:

export ORACLE_HOME=/u01/app/19.0.0/grid 
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/grid/34762026/34768569| grep checkConflictAgainstOHWithDetail 
Prereq "checkConflictAgainstOHWithDetail" passed.
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/grid/34762026/34765931| grep checkConflictAgainstOHWithDetail
Prereq "checkConflictAgainstOHWithDetail" passed.
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/grid/34762026/33575402| grep checkConflictAgainstOHWithDetail
Prereq "checkConflictAgainstOHWithDetail" passed.
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/grid/34762026/34863894| grep checkConflictAgainstOHWithDetail
Prereq "checkConflictAgainstOHWithDetail" passed.
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/grid/34762026/34768559| grep checkConflictAgainstOHWithDetail
Prereq "checkConflictAgainstOHWithDetail" passed.

Ensure all checks pass before proceeding.


3. Stop Oracle Databases
Stop all Oracle databases managed by the Grid Infrastructure:
Here is a short shell for this, you can modify as per your requirement or environment

#!/bin/bash

# Set Oracle environment variables
export ORACLE_HOME=/path/to/oracle/home
export PATH=$ORACLE_HOME/bin:$PATH

# Get the list of all database names
DB_NAMES=$(srvctl config database | awk '{print $1}')
# Stop each database
for DB in $DB_NAMES
do
  echo "Stopping database: $DB"
  srvctl stop database -d $DB
if [ $? -eq 0 ]; then
    echo "Successfully stopped database: $DB"
  else
    echo "Failed to stop database: $DB"
  fi
done

echo "All databases have been stopped."


4. Apply the Patch Using OPatchAuto
Switch to the root user and apply the patch using opatchauto:

sudo su - root
export ORACLE_HOME=/u01/app/19.0.0/grid
export PATH=$ORACLE_HOME/OPatch:$PATH
$ORACLE_HOME/OPatch/opatchauto apply /home/grid/34762026 -oh $ORACLE_HOME


5. Verify Patch Application
After the patch application completes, verify the applied patches:

$ORACLE_HOME/OPatch/opatch lsinventory | grep -i 19.18

Check that the new patches appear in the inventory.



6. Check Cluster Status
Verify the status of the cluster resources to ensure everything is running smoothly:

crsctl stat res -t



7. Restart High Availability Services (HAS)
If you manually stopped HAS, restart it:
Ensure HAS is enabled for automatic startup if required 

crsctl start has
crsctl enable has


8. Confirm the Patch Level
Check the current patch level of Oracle High Availability Services:

crsctl query has releasepatch
crsctl query has softwarepatch


9. Start Oracle Databases
Restart your Oracle databases:

srvctl start database -d <db_unique_name>


Conclusion

Patching Oracle Grid Infrastructure 19c is a critical task to maintain your system’s security and performance. By following this comprehensive guide, you can ensure a smooth and successful patching process. If you encounter any issues, consult the logs generated by opatchauto and Oracle's support resources for troubleshooting.

For more detailed commands and options, always refer to the official Oracle documentation and support. 

Happy patching! 😉




No comments:

Post a Comment