Check patch level of Oracle RDBMS from OS

Most software only have a single patch process to update the software, however relational databases are a bit different.  You have both a binary set of files for the software and the internal configuration and objects within the database itself.   Thus, it is necessary to validate data both patch levels at the OS level and database level.   Mismatch patches at this level can cause significant errors during operations. 

Check Oracle Patch level at OS

To see the binary level patching of the Oracle software packages,  you have to use the opatch utility to see the internal entries in oraInventory directory.  Use the following opatch command to view your oraInventory. 



/code
opatch lsinventory

sun1{orcl}-~> opatch lsinventory
Oracle Interim Patch Installer version 12.2.0.1.23
Copyright (c) 2021, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/product/12.2.0/db_home1
Central Inventory : /oracle/oraInventory
   from           : /oracle/product/12.2.0/db_home1/oraInst.loc
OPatch version    : 12.2.0.1.23
OUI version       : 12.2.0.1.4
Log file location : /oracle/product/12.2.0/db_home1/cfgtoollogs/opatch/opatch2021-08-18_08-31-56AM_1.log

Lsinventory Output file location : /oracle/product/12.2.0/db_home1/cfgtoollogs/opatch/lsinv/lsinventory2021-08-18_08-31-56AM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: sun1.testdomain.com
ARU platform id: 23
ARU platform description:: Solaris Operating System (SPARC 64-bit)


Installed Top-level Products (1):

Oracle Database 12c                                                  12.2.0.1.0
There are 1 products installed in this Oracle Home.


Interim patches (3) :

Patch  32473172     : applied on Fri Jun 04 12:55:51 EDT 2021
Unique Patch ID:  24158925
Patch description:  "OJVM RELEASE UPDATE 12.2.0.1.210420 (32473172)"
   Created on 1 Apr 2021, 09:12:15 hrs UTC
   Bugs fixed:
     25811105, 25890046, 26023042, 26570134, 27000702, 27461740, 27952586
     27642235, 27539876, 28502098, 28915870, 29254623, 29774362, 30160625
     30534662, 30855101, 31306261, 26716835, 31668872, 29224710, 28394726
     24817447, 32165759, 31997805, 26451793, 32523206, 29415774

Patch  32692908     : applied on Fri Jun 04 12:50:09 EDT 2021
Unique Patch ID:  24229706
   Created on 13 May 2021, 11:26:43 hrs PST8PDT
   Bugs fixed:
     29839481, 31193511
   This patch overlays patches:
     32507738
   This patch needs patches:
     32507738
   as prerequisites

Patch  32507738     : applied on Fri Jun 04 12:46:30 EDT 2021
Unique Patch ID:  24169281
Patch description:  "Database Apr 2021 Release Update : 12.2.0.1.210420 (32507738)"
   Created on 9 Apr 2021, 05:33:05 hrs UTC
   Bugs fixed:
     7391838, 8480838, 8932139, 8975044, 12763598, 13554903, 14221306
     14690846, 15931756, 16002385, 16438495, 16727454, 16942578, 17027695
     17533661, 17947871, 17958365, 18308268, 18521691, 18594510, 18774543
     18878420, 18986501, 19072655, 19211433, 19285025, 19327292, 19526548
     19614243, 19647894

Oracle Patch Level in Database





Most software only have a single patch process to update the software, however relational databases are a bit different.  You have both a binary set of files for the software and the internal configuration and objects within the database itself.   Thus, it is necessary to validate data both patch levels at the OS level and database level.   Mismatch patches at this level can cause significant errors during operations. 


To see the patch level of the internal database libraries you have to query the data dictionary view “dba_registry_sqlpatch”.    Connect to one of the databases you have in your current server using sqlplus and execute the below query.


column action_time format a28
column action format a8
column version format a8
column comments format a30
column status format a10
set line 200 pages 500
select patch_id,  version, status, Action,Action_time from dba_registry_sqlpatch order by action_time desc;




orcl (SYS)> column action_time format a28
column action format a8
column version format a8
column comments format a30
column status format a10
set line 200 pages 500
select patch_id,  version, status, Action,Action_time from dba_registry_sqlpatch order by action_time desc;orcl (SYS)> orcl (SYS)> orcl (SYS)> orcl (SYS)> orcl (SYS)> orcl (SYS)>

  PATCH_ID VERSION  STATUS     ACTION   ACTION_TIME
---------- -------- ---------- -------- ----------------------------
  32228578 12.2.0.1 SUCCESS    APPLY    19-MAY-21 02.53.44.053902 PM
  32119931 12.2.0.1 SUCCESS    APPLY    19-MAY-21 02.53.43.930720 PM
  31668898 12.2.0.1 SUCCESS    ROLLBACK 19-MAY-21 02.53.43.919599 PM
  31741641 12.2.0.1 SUCCESS    APPLY    01-DEC-20 08.50.09.424579 PM