文章版权所有 Jusin Hao(luckyfriends) ,支持原创,转载请注明
1. Oracle审计例子
1.1. 创建delete审计
--创建审计NC57模式下面bd_psndoc表的delete操作
Begin
Dbms_Fga.Add_Policy(Object_Schema => 'SCOTT',
Object_Name => 'T1',
Policy_Name => 'T1_audit_delete',
Statement_Types => 'delete');
End;
/
---查看捕获策略
Select * From Dba_Audit_Policies;
Order By Timestamp;
select * from t1 where id=4200;
delete t1 where id=4200;commit;
--查看捕获信息
Select Timestamp, Userhost, Os_User, Db_User, Object_Schema, Object_Name, Statement_Type, Sql_Text, Policy_Name
From Dba_Fga_Audit_Trail
1.2. 创建insert升级
--创建审计scott模式下面bd_psndoc表的insert操作
Begin
Dbms_Fga.Add_Policy(Object_Schema => 'SCOTT',
Object_Name => 'T1',
Policy_Name => 'T1_audit_inset',
Statement_Types => 'insert');
End;
/
---查看捕获策略
Select a.object_schema,a.object_name,a.policy_name,a.Policy_Text,a.enabled,a.sel,a.ins,a.upd,a.del,a.audit_trail,a.policy_column_options From Dba_Audit_Policies a;
select * from t1 where id=4120;
select * from t1 where id=4120;
insert into t1 values ('4120',to_date('2002-12-25 16:26:12','YYYY-MM-DD hh24:mi:ss'),'aaaaaaaaaaaaaa');
commit;
--查看捕获信息
Select Timestamp, Userhost, Os_User, Db_User, Object_Schema, Object_Name, Statement_Type, Sql_Text, Policy_Name
From Dba_Fga_Audit_Trail
Order By Timestamp;
1.3. 删除审计
Begin
Dbms_Fga.drop_policy(Object_Schema => 'SCOTT',
Object_Name => 'T1',
Policy_Name => 'T1_audit_inset');
End;
/
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14710393/viewspace-1171452/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14710393/viewspace-1171452/