Patching in Oracle
Step 1:
• Download Patch p34133642_19.16.00_Linux-x86-64
• Make sure the minimum OPATCH version is [Link].30
Step 2:
To update the OPATCH version we need to download it first and then replace
it with the existing OPATCH in ORACLE HOME.
Step 3:
After downloading the OPATCH and PATCH copy both files to the Database
server. In my case, I have copied both files to /u02 mount point.
Step 4:
Before updating the OPATCH version, you should check the current version of OPATCH.
$cd $ORACLE_HOME/OPatch
$./opatch version
OPatch Version: [Link].17
OPatch succeeded.
Step 5:
In my case the OPATCH version is 12.2.o.1.17 and we need the minimum OPATCH version to be
[Link].30.
$ cd $ORACLE_HOME/
$mv OPatch OPatch_bkp
Upgrade OPATCH
Upgrade the OPATCH utility, just unzip the newly downloaded opatch utility version in
ORACLE_HOME directly.
$unzip /u02/p6880880_190000_Linux-x86-64 -d $ORACLE_HOME/
Once the above command is completed then check the OPATCH version again.
$ ./opatch version
OPatch Version: [Link].35
OPatch succeeded.
This time you can see the OPATCH version successfully updating.
Step 6:
Verify the Database Current
version
Using the below command verify the current version details and some other information related to
the database.
SQL> select BANNER_FULL from v$version;
BANNER_FULL
--------------------------------------------------------------------------------
Oracle Database 19c Enterprise Edition Release [Link].0 - Production
Version [Link].0
Check dba_registry status
Registry verification is an important part of the patching activity.
SQL>col comp_id for a10
SQL>col version for a11
SQL>col status for a10
SQL>col comp_name for a37
SQL>select comp_id,comp_name,version,status from dba_registry;
COMP_ID COMP_NAME VERSION STATUS
---------- ------------------------------------- ----------- ----------
CATALOG Oracle Database Catalog Views [Link].0 VALID
CATPROC Oracle Database Packages and Types [Link].0 VALID
RAC Oracle Real Application Clusters [Link].0 OPTION OFF
JAVAVM JServer JAVA Virtual Machine [Link].0 VALID
XML Oracle XDK [Link].0 VALID
CATJAVA Oracle Database Java Packages [Link].0 VALID
APS OLAP Analytic Workspace [Link].0 VALID
XDB Oracle XML Database [Link].0 VALID
OWM Oracle Workspace Manager [Link].0 VALID
CONTEXT Oracle Text [Link].0 VALID
ORDIM Oracle Multimedia [Link].0 VALID
SDO Spatial [Link].0 VALID
XOQ Oracle OLAP API [Link].0 VALID
OLS Oracle Label Security [Link].0 VALID
DV Oracle Database Vault [Link].0 VALID
15 rows selected.
Step 7:
Rollback Plan
Due to any type of error if patching got failed, then you must have a backup plan.
• Take Oracle Home Backup
• Full Database RMAN Backup or Create Guaranteed Restore Point.
Take Oracle Home backup
$cd $ORACLE_HOME
$tar -cvf oracle_home_15jan2023.tar $ORACLE_HOME
Step 8:
Let's start the preparation for applying the patch. Unzip the path in the /u02 directory using the
following commands.
Unzip the Patch
$unzip /u02/p34133642_19.16.00_Linux-[Link] -d /u02
Note:
Yes, check the prerequisites before applying the patch using the following command.
Check prerequisites
$cd /u02/34133642
$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail
-ph ./
Output from the above query, if everything is fine.
Oracle Interim Patch Installer version [Link].35
Copyright (c) 2023, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u02/app/oracle/product/19.3.0/db_home
Central Inventory : /u01/app/oraInventory
from : /u02/app/oracle/product/19.3.0/db_home/[Link]
OPatch version : [Link].35
OUI version : [Link].0
Log file location :
/u02/app/oracle/product/19.3.0/db_home/cfgtoollogs/opatch/opatch2023-
01-12_23-58-36PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
Step 9:
Stop all Database services
Step 10:
Using the following command applies the patch.
Note:
Make sure 7 GB of disk space is free in your binary location otherwise the patch will be failed.
Execute opatch apply
$cd /u02/34133642
34133642]$ORACLE_HOME/OPatch/opatch apply
Patching component [Link], [Link].0...
Patching component [Link], [Link].0...
Patching component [Link], [Link].0...
Patch 34133642 successfully applied.
Sub-set patch [29517242] has become inactive due to the application of a
super-set patch [34133642].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location:
/u02/app/oracle/product/19.3.0/db_home/cfgtoollogs/opatch/opatch2023-
01-13_00-09-07AM_1.log
OPatch succeeded.
Step 11:
Start All database services
Once opatch apply successfully, then start all the database services.
Step 12:
Post PATCH steps
Now it's time to run datapatch -verbose which updates the patch
information at the database binary & dictionary level as well as binary files.
Run datapatch -verbose
34133642]$ cd $ORACLE_HOME/OPatch
OPatch]$ ./datapatch -verbose
Step 13:
Execute [Link]
Once datapatch -verbose is completed then execute the utlrp script to
validate the invalid objects.
SQL> @?/rdbms/admin/[Link]
Step 14:
Verify the PATCH
Check applied patch details using lsinventory command.
OPatch]$ ./opatch lsinventory
Oracle Interim Patch Installer version [Link].35
Copyright (c) 2023, Oracle Corporation. All rights reserved.
Oracle Home : /u02/app/oracle/product/19.3.0/db_home
Central Inventory : /u01/app/oraInventory
from : /u02/app/oracle/product/19.3.0/db_home/[Link]
OPatch version : [Link].35
OUI version : [Link].0
Log file location :
/u02/app/oracle/product/19.3.0/db_home/cfgtoollogs/opatch/opatch2023-
01-13_07-35-21AM_1.log
Lsinventory Output file location :
/u02/app/oracle/product/19.3.0/db_home/cfgtoollogs/opatch/lsinv/lsinven
tory2023-01-13_07-[Link]
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: noida
ARU platform id: 226
ARU platform description:: Linux x86-64
Installed Top-level Products (1):
Oracle Database 19c [Link].0
There are 1 products installed in this Oracle Home.
Interim patches (2) :
Patch 34133642 : applied on Fri Jan 13 [Link] IST 2023
Unique Patch ID: 24865470
Patch description: "Database Release Update : [Link].220719 (34133642)"
Created on 14 Jul 2022, [Link] hrs UTC
Bugs fixed:
Verify at the Database Level
SQL> select patch_uid,patch_id,SOURCE_VERSION, TARGET_VERSION, action,
status,action_time,description from dba_registry_sqlpatch;