网站建设
联系我们

细颗粒审计的应用

发布于:2014-02-12 10:10来源:未知 作者:admin 点击:
conn scott/tiger
 
--建立触发的过程。
set serveroutput on
CREATE or replace PROCEDURE  log_emps_salary
(schema# varchar2, table# varchar2, policy# varchar2)
iS
BEGIN
dbms_output.put_line('用户 '||schema#||' 的表 '||table#||' 被查看了,触发了 '||policy#); 
END;
/
 
 
 
--增加细颗粒的审计
begin
dbms_fga.add_policy (
object_schema => 'scott',
object_name => 'emp',
policy_name => 'audit_emps_salary',
audit_condition=> 'deptno=10',
audit_column => 'sal',
handler_schema => 'scott',
handler_module => 'log_emps_salary',
enable => TRUE,
statement_types=> 'select' );
end;
/
 
select * from emp;
select ename from emp;
 
--删除审计
EXEC dbms_fga.drop_policy ( -
 object_schema => 'scott', -
 object_name => 'emp', -
 policy_name => 'audit_emps_salary');
 
--启用审计
begin
dbms_fga.enable_policy (
object_schema => 'scott',
object_name => 'emp',
policy_name => 'audit_emps_salary' );
end;
/
 
--禁用审计
begin
dbms_fga.disable_policy (
object_schema => 'scott',
object_name => 'emp',
policy_name => 'audit_emps_salary' );
end;
/
 
----fga相关的数据字典-------------------
DBA_FGA_AUDIT_TRAIL
ALL_AUDIT_POLICIES
DBA_AUDIT_POLICIES
USER_AUDIT_POLICIES
tag标签:
------分隔线----------------------------
------分隔线----------------------------