Mir Sayeed Hassan – Oracle Blog

Oracle DBA – Tips & Techniques | Learn with real-time examples

  • Translate

  • It’s Me






  • My Certificates

  • Links

    My Acclaim Certification : Credly Profile
    My Oracle ACE Pro Profile

  • Achievements

    Awarded Top 100 Oracle Blogs from Worldwide - #RANK 39
  • VISITORS COUNT

  • Verified International Academic Qualification from World Education Service (WES)

    Verified International Academic Qualification from World Education Service (WES)

  • Jobs

Apply the latest DB RU Patch_19.20 (35320081) on Oracle Database 19C

Posted by Mir Sayeed Hassan on November 1st, 2023

Apply the latest DB RU Patch_19.20 (35320081) on Oracle Database 19C

Check the status of Database

SQL> select instance_name, version, open_mode from V$database, v$instance;

INSTANCE_NAME     VERSION          OPEN_MODE
---------------- ------------------------------
testdb1          19.0.0.0.0        READ WRITE

Verify the lastest OPatch applied on it., If not use the below link to apply

[oracle@test19cdb ~]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 12.2.0.1.40
OPatch succeeded.
https://mirsayeedhassan.com/apply-the-latest-opatch-12-2-0-1-40-for-oracle-database-19c/

[oracle@test19cdb ~]$ cd /u02/source/PATCH_19_20/

Download the Patch from below link

https://support.oracle.com/epmos/faces/PatchSearchResults?_adf.ctrl-state=ym4c1dobw_120&_afrLoop=189225645173189

Create a directory & place the downloaded Patch into it.

[oracle@test19cdb PATCH_19_20]$ ls
p35320081_190000_Linux-x86-64.zip

Unzip the DB Patch

[oracle@test19cdb PATCH_19_20]$ unzip p35320081_190000_Linux-x86-64.zip
[oracle@test19cdb PATCH_19_20]$ ll
total 1729672
drwxr-xr-x. 5 oracle oinstall 4096 Jul 16 00:24 35320081
-rw-rw-r--. 1 oracle oinstall 1769419773 Oct 29 14:40 p35320081_190000_Linux-x86-64.zip
-rw-rw-r--. 1 oracle oinstall 1749054 Jul 18 17:33 PatchSearch.xml
[oracle@test19cdb PATCH_19_20]$ cd 35320081/
[oracle@test19cdb 35320081]$ ls
custom etc files README.html README.txt

Verify the Patch Conflict.

[oracle@test19cdb 35320081]$ /u01/app/oracle/product/19c/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.2.0.1.40
Copyright (c) 2023, Oracle Corporation. All rights reserved.

PREREQ session
Oracle Home : /u01/app/oracle/product/19c/db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/19c/db_1/oraInst.loc
OPatch version : 12.2.0.1.40
OUI version : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2023-10-31_15-05-05PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

Check the patches applied until now.

[oracle@test19cdb 35320081]$ $ORACLE_HOME/OPatch/opatch lspatches
34765931;DATABASE RELEASE UPDATE : 19.18.0.0.230117 (REL-JAN230131) (34765931)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

OPatch succeeded.

Shutdown database & listener

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@test19cdb 35320081]$ lsnrctl stop

Start Apply the Patch

[oracle@test19cdb 35320081]$ /u01/app/oracle/product/19c/db_1/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.40
Copyright (c) 2023, Oracle Corporation. All rights reserved.

Oracle Home : /u01/app/oracle/product/19c/db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/19c/db_1/oraInst.loc
OPatch version : 12.2.0.1.40
OUI version : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2023-10-31_18-13-44PM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 35320081

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/19c/db_1')

Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '35320081' to OH '/u01/app/oracle/product/19c/db_1'
ApplySession: Optional component(s) [ oracle.network.gsm, 19.0.0.0.0 ] , [ oracle.rdbms.ic, 19.0.0.0.0 ] , [ oracle.rdbms.tg4db2, 19.0.0.0.0 ] , [ oracle.tfa, 19.0.0.0.0 ] , [ oracle.rdbms.tg4msql, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.ons.cclient, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4ifmx, 19.0.0.0.0 ] , [ oracle.rdbms.tg4sybs, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4tera, 19.0.0.0.0 ] , [ oracle.sdo.companion, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.ons.eons.bwcompat, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [ oracle.jdk, 1.8.0.191.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.rdbms, 19.0.0.0.0...
Patching component oracle.rdbms.util, 19.0.0.0.0...
Patching component oracle.rdbms.rsf, 19.0.0.0.0...
Patching component oracle.assistants.acf, 19.0.0.0.0...
Patching component oracle.assistants.deconfig, 19.0.0.0.0...
Patching component oracle.assistants.server, 19.0.0.0.0...
Patching component oracle.blaslapack, 19.0.0.0.0...
Patching component oracle.buildtools.rsf, 19.0.0.0.0...
Patching component oracle.ctx, 19.0.0.0.0...
Patching component oracle.dbdev, 19.0.0.0.0...
Patching component oracle.dbjava.ic, 19.0.0.0.0...
Patching component oracle.dbjava.jdbc, 19.0.0.0.0...
Patching component oracle.dbjava.ucp, 19.0.0.0.0...
Patching component oracle.duma, 19.0.0.0.0...
Patching component oracle.javavm.client, 19.0.0.0.0...
Patching component oracle.ldap.owm, 19.0.0.0.0...
Patching component oracle.ldap.rsf, 19.0.0.0.0...
Patching component oracle.ldap.security.osdt, 19.0.0.0.0...
Patching component oracle.marvel, 19.0.0.0.0...
Patching component oracle.network.rsf, 19.0.0.0.0...
Patching component oracle.odbc.ic, 19.0.0.0.0...
Patching component oracle.ons, 19.0.0.0.0...
Patching component oracle.ons.ic, 19.0.0.0.0...
Patching component oracle.oracore.rsf, 19.0.0.0.0...
Patching component oracle.perlint, 5.28.1.0.0...
Patching component oracle.precomp.common.core, 19.0.0.0.0...
Patching component oracle.precomp.rsf, 19.0.0.0.0...
Patching component oracle.rdbms.crs, 19.0.0.0.0...
Patching component oracle.rdbms.dbscripts, 19.0.0.0.0...
Patching component oracle.rdbms.deconfig, 19.0.0.0.0...
Patching component oracle.rdbms.oci, 19.0.0.0.0...
Patching component oracle.rdbms.rsf.ic, 19.0.0.0.0...
Patching component oracle.rdbms.scheduler, 19.0.0.0.0...
Patching component oracle.rhp.db, 19.0.0.0.0...
Patching component oracle.sdo, 19.0.0.0.0...
Patching component oracle.sdo.locator.jrf, 19.0.0.0.0...
Patching component oracle.sqlplus, 19.0.0.0.0...
Patching component oracle.sqlplus.ic, 19.0.0.0.0...
Patching component oracle.wwg.plsql, 19.0.0.0.0...
Patching component oracle.xdk.parser.java, 19.0.0.0.0...
Patching component oracle.ldap.ssl, 19.0.0.0.0...
Patching component oracle.ctx.rsf, 19.0.0.0.0...
Patching component oracle.rdbms.dv, 19.0.0.0.0...
Patching component oracle.rdbms.drdaas, 19.0.0.0.0...
Patching component oracle.network.client, 19.0.0.0.0...
Patching component oracle.rdbms.hsodbc, 19.0.0.0.0...
Patching component oracle.network.listener, 19.0.0.0.0...
Patching component oracle.ldap.rsf.ic, 19.0.0.0.0...
Patching component oracle.dbtoolslistener, 19.0.0.0.0...
Patching component oracle.nlsrtl.rsf, 19.0.0.0.0...
Patching component oracle.xdk.xquery, 19.0.0.0.0...
Patching component oracle.rdbms.install.common, 19.0.0.0.0...
Patching component oracle.ovm, 19.0.0.0.0...
Patching component oracle.oraolap, 19.0.0.0.0...
Patching component oracle.rdbms.rman, 19.0.0.0.0...
Patching component oracle.install.deinstalltool, 19.0.0.0.0...
Patching component oracle.rdbms.install.plugins, 19.0.0.0.0...
Patching component oracle.rdbms.lbac, 19.0.0.0.0...
Patching component oracle.sdo.locator, 19.0.0.0.0...
Patching component oracle.oraolap.dbscripts, 19.0.0.0.0...
Patching component oracle.oraolap.api, 19.0.0.0.0...
Patching component oracle.ctx.atg, 19.0.0.0.0...
Patching component oracle.javavm.server, 19.0.0.0.0...
Patching component oracle.rdbms.hs_common, 19.0.0.0.0...
Patching component oracle.xdk, 19.0.0.0.0...
Patching component oracle.xdk.rsf, 19.0.0.0.0...
Patching component oracle.ldap.client, 19.0.0.0.0...
Patching component oracle.mgw.common, 19.0.0.0.0...
Patching component oracle.odbc, 19.0.0.0.0...
Patching component oracle.precomp.lang, 19.0.0.0.0...
Patching component oracle.precomp.common, 19.0.0.0.0...
Patching component oracle.jdk, 1.8.0.201.0...
Patch 35320081 successfully applied.
Sub-set patch [34765931] has become inactive due to the application of a super-set patch [35320081].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location: /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2023-10-31_18-13-44PM_1.log

OPatch succeeded.

Verify the patch applied

[oracle@test19cdb ~]$ $ORACLE_HOME/OPatch/opatch lspatches
35320081;Database Release Update : 19.20.0.0.230718 (35320081)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

OPatch succeeded.

OR

[oracle@test19cdb ~]$ $ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 12.2.0.1.40
Copyright (c) 2023, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/19c/db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/19c/db_1/oraInst.loc
OPatch version : 12.2.0.1.40
OUI version : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2023-11-01_09-42-27AM_1.log
Lsinventory Output file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/lsinv/lsinventory2023-11-01_09-42-27AM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: test19cdb
ARU platform id: 226
ARU platform description:: Linux x86-64
Installed Top-level Products (1):
Oracle Database 19c 19.0.0.0.0
There are 1 products installed in this Oracle Home.
Interim patches (2) :

Patch 35320081 : applied on Tue Oct 31 18:18:34 IRST 2023
Unique Patch ID: 25314491
Patch description: "Database Release Update : 19.20.0.0.230718 (35320081)"
Created on 15 Jul 2023, 12:54:11 hrs UTC
Bugs fixed:
10123661, 1297945, 14570574, 14735102, 15931756, 15959416, 16662822
--------------------------------------------------------------------------------
OPatch succeeded.

Check the list of DB Patches are applied init it.

[oracle@test19cdb ~]$ $ORACLE_HOME/OPatch/opatch lsinv | grep applied
Patch 35320081 : applied on Tue Oct 31 18:18:34 IRST 2023
Patch 29585399 : applied on Thu Apr 18 11:51:33 IRDT 2019

Bring back the Oracle Database & Listener, Verify the POST UPDATE THE PATCH

SQL> startup
ORACLE instance started.

Total System Global Area 2415915656 bytes
Fixed Size 9175688 bytes
Variable Size 989855744 bytes
Database Buffers 1409286144 bytes
Redo Buffers 7598080 bytes
Database mounted.
Database opened.
SQL> show pdbs

CON_ID   CON_NAME     OPEN MODE     RESTRICTED
---------- ------------------------------ ---------- ----------
2        PDB$SEED     READ ONLY      NO
3        PDB_TEST1    MOUNTED

Open the Pluggable Databases

SQL> alter pluggable database all open;

Start the listener

[oracle@test19cdb ~]$ lsnrctl start
SQL> alter system register;
System altered.
SQL> alter session set container=PDB_TEST1;
Session altered.
SQL> alter system register;
System altered.

Therefore the DB Patch are applied in Container., Need to apply for All PDB Database as fallow.

[oracle@test19cdb ~]$ $ORACLE_HOME/OPatch/
[oracle@test19cdb OPatch]$ ./datapatch -verbose
SQL Patching tool version 19.20.0.0.0 Production on Wed Nov 1 09:46:55 2023
Copyright (c) 2012, 2023, Oracle. All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_14934_2023_11_01_09_46_55/sqlpatch_invocation.log

Connecting to database...OK
Gathering database info...done

Note: Datapatch will only apply or rollback SQL fixes for PDBs
that are in an open state, no patches will be applied to closed PDBs.
Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
(Doc ID 1585822.1)

Bootstrapping registry and package to current versions...done
Determining current state...done
Current state of interim SQL patches:
No interim patches found
Current state of release update SQL patches:
Binary registry:
19.20.0.0.0 Release_Update 230715022800: Installed
PDB CDB$ROOT:
No release update patches installed
PDB PDB$SEED:
Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 12-MAR-23 12.59.19.089339 PM
PDB PDB_TEST1:
Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 12-MAR-23 12.59.19.089339 PM

Adding patches to installation queue and performing prereq checks...done
Installation queue:
For the following PDBs: CDB$ROOT
No interim patches need to be rolled back
Patch 35320081 (Database Release Update : 19.20.0.0.230718 (35320081)):
Apply from 19.1.0.0.0 Feature Release to 19.20.0.0.0 Release_Update 230715022800
No interim patches need to be applied
For the following PDBs: PDB$SEED PDB_TEST1
No interim patches need to be rolled back
Patch 35320081 (Database Release Update : 19.20.0.0.230718 (35320081)):
Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.20.0.0.0 Release_Update 230715022800
No interim patches need to be applied

Installing patches...
Patch installation complete. Total patches installed: 3

Validating logfiles...done
Patch 35320081 apply (pdb CDB$ROOT): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35320081/25314491/35320081_apply_TESTDB1_CDBROOT_2023Nov01_09_49_36.log (no errors)
Patch 35320081 apply (pdb PDB$SEED): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35320081/25314491/35320081_apply_TESTDB1_PDBSEED_2023Nov01_10_07_10.log (no errors)
Patch 35320081 apply (pdb PDB_TEST1): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35320081/25314491/35320081_apply_TESTDB1_PDB_TEST1_2023Nov01_10_07_12.log (no errors)

Automatic recompilation incomplete; run utlrp.sql to revalidate.
PDBs: PDB_TEST1 PDB$SEED

SQL Patching tool complete on Wed Nov 1 10:18:00 2023

Hence applied for all PDB DB’s & veified.

SQL> show pdbs

CON_ID    CON_NAME     OPEN MODE      RESTRICTED
---------- --------------------------------------
2        PDB$SEED      READ ONLY       NO
3        PDB_TEST1     READ WRITE      NO
SQL> select CON_ID, TO_CHAR(action_time, 'YYYY-MM-DD') AS action_time, PATCH_ID, PATCH_TYPE, ACTION, DESCRIPTION, SOURCE_VERSION, TARGET_VERSION from CDB_REGISTRY_SQLPATCH order by CON_ID, action_time, patch_id;

CON_ID   ACTION_TIM    PATCH_ID     PATCH_TYPE      ACTION  DESCRIPTION                             SOURCE_VERSION     TARGET_VERSION
---------- ---------- ---------- ---------- --------------- --------------------------------------------------------------------------
1        2023-11-01    35320081     RU APPLY       Database Release Update : 19.20.0.0.230718 (35320081) 19.1.0.0.0      19.20.0.0.0

Run the below script to validate all the INVALID Objects in Database

SQL> @?/rdbms/admin/utlrp.sql;
Session altered.

TIMESTAMP
--------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2023-11-01 10:25:26

DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC> objects in the database. Recompilation time is proportional to the
DOC> number of invalid objects in the database, so this command may take
DOC> a long time to execute on a database with a large number of invalid
DOC> objects.
DOC>
DOC> Use the following queries to track recompilation progress:
DOC>
DOC> 1. Query returning the number of invalid objects remaining. This
DOC> number should decrease with time.
DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC> 2. Query returning the number of objects compiled so far. This number
DOC> should increase with time.
DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC> This script automatically chooses serial or parallel recompilation
DOC> based on the number of CPUs available (parameter cpu_count) multiplied
DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC> On RAC, this number is added across all RAC nodes.
DOC>
DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC> recompilation. Jobs are created without instance affinity so that they
DOC> can migrate across RAC nodes. Use the following queries to verify
DOC> whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC> 1. Query showing jobs created by UTL_RECOMP
DOC> SELECT job_name FROM dba_scheduler_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC> 2. Query showing UTL_RECOMP jobs that are running
DOC> SELECT job_name FROM dba_scheduler_running_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#

PL/SQL procedure successfully completed.

TIMESTAMP
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END 2023-11-01 10:25:27

DOC> The following query reports the number of invalid objects.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#

OBJECTS WITH ERRORS
-------------------
0

DOC> The following query reports the number of exceptions caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC> Note: Typical compilation errors (due to coding errors) are not
DOC> logged into this table: they go into DBA_ERRORS instead.
DOC>#

ERRORS DURING RECOMPILATION
---------------------------
0
Function created.
PL/SQL procedure successfully completed.

Function dropped.
PL/SQL procedure successfully completed.

Check the INVALID Object in PDB Database

SQL> select count(*) from all_objects where status='INVALID' group by owner;
no rows selected

=====Hence tested & verified in our test env====