R11i,12.0.x,12.1.x
=============
From Oracle Applications Release 11i to 12.1.x, Patch application Status can be queried from ad_bugs or ad_applied_patches tables
Query to check whether patch is applied on a instance.
SQL>select bug_number,creation_date,last_update_date from apps.ad_bugs where bug_number=’&patchnum’;
SQL> select PATCH_NAME,CREATION_DATE from apps.ad_applied_patches where PATCH_NAME=’&patchnum’;
What is difference between above two Queries?
Suppose, we applied a patch which has multiple bugfixes.The details of all bugs fixed by the patch are listed in ad_bugs table.
In Contrast,ad_applied_patches table give info only about the patches which are applied through adpatch utility.
R12.2
=====
From Release 12.2, Online Patching utility(adop) is used for Patching application Filesystem.
Querying the data from ad_bugs or ad_applied_patches tables may not give correct information.Because, online patching can be aborted anytime prior to Cutover Phase.
ad_bugs or ad_applied_patches tables may contain entries for patches which are started through adop and later aborted.
The below query gives accurate Information about Patch Applied Status in R12.2
select AD_PATCH.IS_PATCH_APPLIED(‘$release’,’$appltop_id’,’$patch_no’,’$language’) from dual;
example sql:
SELECT adb.bug_number,ad_patch.is_patch_applied(’11i’, 1045, adb.bug_number)
FROM ad_bugs adb
WHERE adb.bug_number in (22498647);
or for single app tier installations:
select ad_patch.is_patch_applied(‘R12’,-1,22498647) from dual;
Sample Output:
EXPLICIT = applied
NOT APPLIED = not applied / aborted
Database
=========
Login to Database node as the database os user
Set environment using commands below
$export ORACLE_HOME=/u01/app/oracle/product/112
$export PATH=$PATH:$ORACLE_HOME/Opatch
$which opatch
==>It should give output like /u01/app/oracle/product/112/Opatch
$opatch lsinventory -invPtrLoc $ORACLE_HOME/oraInst.loc
== This gives list of all patches applied to the ORACLE_HOME
$opatch lsinventory -invPtrLoc $ORACLE_HOME/oraInst.loc|grep 988765
==> To check if a particular patch is applied to the ORACLE_HOME