Tuesday, August 03, 2010

Audit SQL with audit_trail db_extended

1. Enabling DB_EXTENDED for AUDIT_TRAIL PARAMETER

alter system set audit_trail=db_extended scope=spfile;
System altered.

shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.

startup
ORACLE instance started.

show parameter audit_trail

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_trail string DB_EXTENDED

2. Setup audit on Sample table.

AUDIT INSERT,UPDATE,DELETE,SELECT on bkp_dba_data_files by ACCESS;

3. Do some DDL and DML

   select * from bkp_dba_data_files;
   update bkp_dba_data_files set bytes = '5242880' where file_id = 4

4. AUDIT_TRAIL capturing sql text
   Select * from dba_audit_trail order by timestamp desc

This would show the audit trail with sql texts.

No comments: