跟踪数据库变化的数据-审计

一.审计(audit)监视用户所执行的数据库操作,将审计跟踪结果存放到OS文件或者数据库中

激活审计

sql>conn / as sysdab

sql>show parameter audit_sys_operations;默认为falsealter

sql>alter system set audit_sys_operation-TRUE scope=spfile;

sql>alter system set audit_trail=db scope=spfile;

sql>startup force

定义审计的表

execute dbms_fgs.add_policy(object_schema=>'bankuser',object_name=>'emp',policy_name=>'chk_emp',statement_types=>'insert,update,delete');

授权普通用户查看审计表,默认dba可查看

sql>grant select on dba_fga_audit_trail to banluser;

执行增删改查操作,查看审计结果

sql>conn bankuser/bankpwd

sql>select t.timestamp,t.sql_text from sys.dba_fga_audit_trail t;

取消审计

sql>conn sys/sys as sysdab

sql>execute dbms_fgs.add_policy(object_schema=>'bankuser',object_name=>'emp',policy_name=>'chk_emp');




你可能感兴趣的:(oracle)