After finding out, MGMT$APPLIED_PATCHSET view did not have the patching details for the targets, I explored and found out there are 2 options you can adopt to find the patch details.
- Using metric extension and deploy to oracle_database target type.
This would need 2 metric extensions because of pre-12c and 12c. Pre-12c (11g...), the information can be obtained from
select id patch_id, action, version, to_char(action_time, 'mm/dd/yyyy hh24:mi:ss') applied_time, comments, bundle_series
from dba_registry_history;
For 12c, the metric extension SQL would look like this.
select patch_id, action, version, to_char(action_time, 'mm/dd/yyyy hh24:mi:ss') applied_time, description, bundle_series
from DBA_REGISTRY_SQLPATCH ;
2. Internal views in SYSMAN that had patching info.
select
p.abstract as patch_description,
p.patch_id as patch_id,
p.patch_type as patch_type,
p.product as patch_product,
p.platform as patch_platform,
p.release as patch_release,
f.initially_discovered as first_discovered_date_by_oem,
host.target_guid as host_guid,
host.target_name as host_name,
props.property_value as home_location,
t.target_guid as target_guid,
t.target_name as target_name,
t.target_type as target_type
from
mgmt$target_properties props,
mgmt_targets host,
MGMT_ASSOC_INSTANCES a,
mgmt$target t,
MOS$PA_FINAL_RECOM f,
MGMT$ARU_PATCH_RECOM_MD p
where
1=1 -- p.classification = 'Security'
and f.patch_uid = p.patch_uid
and f.target_guid = t.target_guid
and t.target_guid = props.target_guid
and props.property_name = 'OracleHome'
and props.property_type = 'INSTANCE'
and a.assoc_type = 'hosted_by'
and a.source_me_guid = t.target_guid
and a.dest_me_guid = host.target_guid
and host.target_type = 'host'
and host.is_group = 0
and p.product = 'Oracle Database' ;