19c Database Patching Steps

Step 1: Download the Patches

Search for the following keywords on Oracle Metalink to download the CPU patches:

  • Critical Patch Update (CPU) Program JAN 2022

  • Critical Patch Update (CPU) Program APR 2022

  • Critical Patch Update (CPU) Program JUL 2022

  • Critical Patch Update (CPU) Program OCT 2022

Download the Latest OPatch Version:

Verify the current OPatch version:



I opened for the July patch, and here we need to click Patch availability for Oracle products -> 3.1 Oracle database.


Oracle database (3.1) Many Oracle products patches are listed here. I need only Oracle database patches. So, I'll go with the Oracle database 3.1.7



My DB version is 19c So I will choose 3.1.7.3 Oracle database 19c



Here I will download the below database patch and grid patch (GI)

One interesting fact is that if you download the GI Patch Database patch, it will also come under GI Patch. As a result, there is no need to download a database patch separately.

Note: If you only apply the patch in Oracle Home, you must download the database patch. Database Release Update 19.16.0.0.220719 Patch 34133642 

GI Release Update 19.16.0.0.220719 Patch 34130714,



Captured below screenshot for GI Patch (34130714) read me document. In this screenshot database patch also come under single GI patch



Download the Latest OPatch Version:

Verify the current OPatch version:

[oracle@oraclelab1 grid]$ OPatch/opatch version
OPatch Version: 12.2.0.1.17
OPatch succeeded.

If needed, download the latest OPatch:

  • File: p6880880_122010_Linux-x86-64.zip


Step 2: Patch Analysis

Use the following commands to list applied patches:

$ORACLE_HOME/OPatch/opatch lspatches
$ORACLE_HOME/OPatch/opatch lsinventory

Step 3: Conflicts Check and System Space Check

Commands for conflict and space checks are applicable for both GI Home and Oracle Home:

  • Conflict Check:

    $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/<PatchID>
  • System Space Check:

    $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/<PatchID>

Sample Conflict Check Command and output:

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/34155589/34172231


Sample Conflict Check Command and output:

  • $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/<PatchID>



Automated ASM Patching Steps

Automating ASM Patching with Opatch Auto ASM patching can be fully automated using the OPatch auto command. This powerful tool handles everything, from shutting down the database, listener, and ASM instances, to applying patches in the Grid Home, Database Home, and running Datapatch. Finally, it starts up the database listener and ASM instance.

Note: Ensure that OPatch auto is executed by the root user only.


High-Level Steps for ASM Patching using Opatchauto:

  1. Login as Root User: Ensure you have the necessary permissions.

  2. Check Permissions for the Patch: Validate patch permissions.

  3. Set Environment Variables:

    root@oraclelab2 ~]# oraenv
    ORACLE SID = [root] ? +ASM
    The Oracle base has been set to /u01/app/oracle
    export ORACLE_HOME=<ORACLE_HOME>
    export ORACLE_SID=+ASM
    export PATH=$PATH:$ORACLE_HOME/OPatch
    
  4. Source the ASM: Prepare the ASM environment.

  5. Apply the Patch:

    root@oraclelab2 ~]# /u01/app/19.0.0.0/grid/0Patch/opatchauto apply /u01/patches/33509923

High-Level Steps for ASM Patching using Opatch:

  1. Stop Database, Listener, and GI Home.

  2. Grant Patch Directory Permissions.

  3. Verify OPatch Version and Current Patches: Ensure no conflicts and adequate system space.

  4. Apply Patch.

  5. Perform Post-Patching Verification.

  6. Restart Database, Listener, and GI Home.


Database Patching Steps:

  1. Stop Database and Listener.

  2. Grant Patch Directory Permissions.

  3. Check OPatch Version and Current Patches: Ensure no conflicts and adequate system space.

  4. Apply Patch.

  5. Perform Post-Patching Verification.

  6. Restart Database and Listener.


Detailed OPatch Apply Steps:

  1. Navigate to Patch Directory:

    cd /u01/patches/35943109
    $ORACLE_HOME/OPatch/opatch apply
    cd /u01/patches/35648918
    $ORACLE_HOME/OPatch/opatch apply
  2. Check Logs for Issues.

  3. Verify Applied Patches:

    $ORACLE_HOME/OPatch/opatch lspatches | grep -i 35943109
    $ORACLE_HOME/OPatch/opatch lspatches grep -i 35648918
    

Common Steps for ASM & Database Patching: After applying the patches, check the registry to ensure all components are valid. If any component is invalid, contact Oracle support for assistance.



Post Patch Checks

  1. Verify patch application using the registry:

    SELECT PATCH_ID, PATCH_UID, ACTION, STATUS, ACTION_TIME, DESCRIPTION FROM dba_registry_sqlpatch;
  2. Run the datapatch utility:

    cd $ORACLE_HOME/OPatch
    ./datapatch -verbose
  3. Ensure no invalid objects are present

Frequently Used OPatch Commands

  • Find Applied Patches:

    $ORACLE_HOME/OPatch/opatch lspatches
  • Find Inventory Details:

    $ORACLE_HOME/OPatch/opatch lsinventory
  • Find OPatch Version:

    $ORACLE_HOME/OPatch/opatch version
  • Rollback a Patch:

    $ORACLE_HOME/OPatch/opatch rollback -id <PatchID>


Opatch Frequently asked Questions:


What is the difference between opatch apply Vs opatchauto?

Opatch apply: Its manual method we need to shutdown ASM,DB&Listner and apply the patch and start the database

Opatch Auto: Its automated it will shutdown ASM,DB&Listner and apply the Grid home patch+Database Home Patch + Datapatch and start the database it self.

What is the difference Opatch and Opatch napply?

Opatch apply: Its used to apply the singal epatch

Opatch napplay:- Its used to apply multiple patches at same time

$ORACLE_HOME/OPatch/opatch napply -id 15941858,15955138

Multiple database running on single oracle home need to apply datapatch in all database?

Yes, need to apply all database for datapatch for binary level we applied onetime patch If we have 5 database running in single oracle home need to apply datapatch in eash database

Datapatch is online activity we can run anytime no need down time. 


Need to apply datapatch in Dataguared envirnment?

No need to apply datapatch in DG because standby database in munted mode not be in open mode

Can we patch standby DB first or primary DB first? Or patch both together? Which best practice?

We need to apply patch standby database first

What is central Inventory and Local Inventory?


How to find locations of Central Inventory and Local Inventory?

Local Inventry: The inventory directory inside the oracle home called local inventory
inventory_loc=/u01/app/oraInventory

Central Inventory:Global Inventory directory outside of the oracle_home called local inventory
Physical Location /var/opt/oraInst.loc, /etc/oraInst.loc (AIX,Linux)


Comments

Popular posts from this blog

How to troubleshoot long running concurrent request in R12.2

How to run Gather Schema Statistics in R12.2

How to compile forms in R12.2