Wednesday, September 26, 2007

Another FGA

When I tried to find more new thing about FGA (Fine Grained Audit), I found a simple practice to define a simple auditing based on a condition for a table. Here are the steps:

prompt> sqlplus /nolog
SQL> conn / as sysdba
SQL> execute dbms_fga.add_policy('HR', 'EMPLOYEES', 'EMPDEPT_POLICY', 'department_id > 90');
SQL> analyze table hr.employees compute statistics;
SQL> conn hr/hr
SQL> select first_name from employees where department_id = 20;
SQL> select first_name from employees where department_id = 100;
SQL> select distinct deparment_id from employees;
SQL> conn / as sysdba
SQL> select timestamp#, obj$name, policyname, scn, lsqltext from fga_log$;
SQL> execute dbms_fga.drop_policy('HR', 'EMPLOYEES', 'EMPDEPT_POLICY');

No comments: