I am looking for a SQL query to validate the user details are synced with the resources provisioned, to create a BI report with the detected discrepancies.
Basically a SQL query to check if the resources provisioned to the user are in the correct status and are linked correctly to the user
select orc.orc_key,obj.obj_name, pkg.pkg_name,orc.usr_key,usr.usr_login from orc orc,tos tos, oiu oiu, pkg, obj, usr
where
orc.usr_key=usr.usr_key
and tos.tos_key=orc.tos_key
and orc.orc_status not in ('X', 'PX')
and oiu.orc_key=orc.orc_key
and oiu.oiu_prov_start_date is null
and oiu.oiu_prov_end_date is null
and orc.pkg_key = pkg.pkg_key
and pkg.obj_key = obj.obj_key
and oiu.oiu_serviceaccount != '1';