(1)启动审计
conn /as sysdba
show parameter audit_sys_operations;
alter syatem set audit_sys_operations=TRUE scope=spfile;
alter system set audit_trial=db scope=spfile;
(audit_trial还可定义为os)
startup force
show parameter audit_sys_operations;
show parameter audit_trail;
(2)定义要审计的表
dbms_fga.add_policy(object_schema=>'bankuser',object_name=>'emp',policy_name=>'chk_emp',statement_types=>'insert,update,delete');
即对emp表的增删改操作进行审计,由bankuser用户完成,名称为chk_emp
(3)授权普通用户查看审计表
grant select on dba_fga_audit_trail to bankuser;
(4)查询审计结果
select t.timestamp,t.sql_text from sys.dba_fga_audit_trail t
(5)取消审计
execute dbms_fga.drop_policy(object_schema=>'bankuser',object_name=>'emp',policy_name=>'chk_emp');