Monday, August 17, 2015

How to check whether a table is audited or not in Oracle?

Problem

After enabling audit for some tables, I wanted to check a few days later the list of audited tables. Unfortunately I could not find a column like 'ISAUDITED' in dba_audit_trail/AUD$.

Solution

We can find out the list of audited tables in 'DBA_OBJ_AUDIT_OPTS' table as below:


In the list above, the tables are audited for select,insert,update and delete operations as they are marked by 'A/A'

Now we can check whether these audited tables are accessed or not by issuing the following query:

select OBJ_NAME from dba_audit_trail where obj_name in (select object_name from dba_obj_audit_opts);

If this query displays any record, then we can conclude that that table has been accessed.

Also, if an audited table is queried by SYS, then the table will not be tracked in AUD$ or DBA_AUDIT_TRAIL. So make you you query the table by some other user so that you can get your audit tested!

No comments:

Post a Comment