Friday, January 10, 2014

OIM Audit Table: Sample Queries to Find Who did What and When

Here are few sample queries provided by Oracle to find who did what and when:

List the last change set for user with usr_key where the changes are represented  in a relational format:


SELECT usr_key,   usr_login as changed_by_user,  upa_usr.upa_usr_eff_from_date AS changed_time,   field_name,   field_old_value,   field_new_value
 FROM upa_usr, upa_fields,   (SELECT field_new_value AS changed_by_user    FROM upa_fields
   WHERE upa_fields_key =  (SELECT MAX(upa_fields_key)      FROM upa_fields, upa_usr
     WHERE upa_usr.upa_usr_key = upa_fields.upa_usr_key
     AND upa_usr.usr_key = <>
     AND upa_fields.field_name ='Users.Updated By Login'
     )
   )
 WHERE upa_usr.upa_usr_key = upa_fields.upa_usr_key
 AND upa_usr.usr_key = <>;



References:

1 comment:

Unknown said...

This query definetly wrong...
It shows USR_KEY and CHANGED_BY_USER as same person.
and also upa_usr table is wrong. it shows wrong data about changes on the user.
When xelsysadm user does something, It shows It's been done by different person.