Complete Guide to Oracle Database Patching:

CPU, PSU, and Bug Fix Patches

What is Oracle Patching?

Patching is a crucial process in Oracle Database Management, where software updates are applied to fix bugs, security vulnerabilities, and performance issues. Oracle releases patches regularly to enhance the database's stability and security.

Why is Patching Important?

  • Fixes known bugs that affect database performance.

  • Addresses security vulnerabilities to protect against cyber threats.

  • Ensures better stability and database uptime.

  • Required for Oracle Support compliance.

How Oracle Database Patching Works

Oracle Database is written in Java and is used to store and manage large amounts of data. Patching is performed at the Oracle Software level rather than the database level.

For example, after upgrading Oracle Database from 12c to 19c, a job that used to run for 2 hours started taking 8 hours. Upon contacting Oracle Support, it was identified as a bug, and they recommended applying a bug fix patch to resolve the issue.

Types of Oracle Patches

Oracle provides different types of patches:

1. CPU (Critical Patch Update) - Security Patches

  • Released quarterly to address security threats.

  • Fixes security vulnerabilities identified by Oracle.

  • Helps protect sensitive database information.

2. PSU (Patch Set Update) - Security + Priority Fixes

  • Includes CPU patches along with additional fixes.

  • If applied, no need to install CPU patches separately.

  • Fixes major issues impacting business operations.

3. Bug Fix Patches

  • Address specific unresolved issues that are not covered in PSU patches.

  • Provided by Oracle Support based on reported issues.

  • Typically included in the next PSU patch cycle.

👉 All these patches are available at support.oracle.com

How to Apply Oracle Patches

Pre-Requisites Before Applying a Patch

  1. Take backup using RMAN.

  2. Obtain client approval for database downtime.

  3. Ensure sufficient disk space in $ORACLE_HOME.

  4. Identify and verify existing patches using:

    $ORACLE_HOME/OPatch/opatch lsinventory
  5. Check for invalid objects in the database: SELECT COUNT(*) FROM dba_objects WHERE status = 'INVALID';

Steps to Apply a Patch

Step 1: Download the Patch

  • Download from support.oracle.com

  • Extract and read the README file for instructions.

Step 2: Upgrade OPatch Utility (If Required)

  • Check OPatch version:

    $ORACLE_HOME/OPatch/opatch version
  • If the version is outdated, upgrade it:

          cp -R Opatch $ORACLE_HOME

Step 3: Apply the Patch

  • Shutdown the database and related services.

  • Navigate to the extracted patch directory.

  • Run the OPatch command:

    $ORACLE_HOME/OPatch/opatch apply
  • Provide YES when prompted.

Step 4: Apply Patch on Oracle Database Using Datapatch

  • Start the database and apply patch at the database level:

    nohup ./datapatch -verbose &
  • Monitor logs using:

        tail -100f nohup.out

Step 5: Verify Patch Installation

  • Check applied patches:

    $ORACLE_HOME/OPatch/opatch lspatches
  • Verify invalid objects count:

SELECT COUNT(*) FROM dba_objects WHERE status = 'INVALID';

Step 6: Rollback the Patch (If Required)

  • In case of issues, rollback using:

opatch rollback -id <Patch_ID>

Common Issues and Troubleshooting

1. Patch Conflict Issues

  • If a patch is already applied, remove it before reapplying

opatch rollback -id <Patch_ID>

 Check conflicts using:

$ORACLE_HOME/OPatch/opatch lsinventory | grep -i "conflict"

2. Space Issues in ORACLE_HOME

Check available space before applying the patch.

df -h | grep ORACLE_HOME

3. Invalid Objects Post-Patching

If the count increases after patching, run:

@utlrp.sql

Frequently Asked Questions (FAQ)

Q1. What is the difference between CPU and PSU patches?

  • CPU Patch: Security updates only.

  • PSU Patch: Includes CPU patches + additional fixes.

Q2. How can I check the OPatch version?

$ORACLE_HOME/OPatch/opatch version

Q3. How to check applied patches?

$ORACLE_HOME/OPatch/opatch lsinventory

Q4. What should I do if I find conflicts while applying a patch?

  • Identify conflicting patches and rollback the conflicting patch before applying the new one.

  • Use opatch rollback -id <Patch_ID>

Conclusion

Oracle Patching is a crucial maintenance activity that ensures database security, stability, and performance. Always follow best practices, take backups, and monitor logs while applying patches.

Need more help? Visit support.oracle.com for official documentation and updates.


 

Comments

Popular posts from this blog