首页 > 代码库 > oracle 细粒度审计使用
oracle 细粒度审计使用
以scott用户的emp表为示例
----增加策略
begin
DBMS_FGA.ADD_POLICY (
object_schema => ‘SCOTT‘,
object_name => ‘EMP‘,
policy_name => ‘mypolicy1‘,
handler_schema => NULL,
handler_module => NULL,
enable => TRUE,
statement_types => ‘INSERT, UPDATE,DELETE‘,
audit_column_opts => DBMS_FGA.ANY_COLUMNS);
end;
----启用策略
begin
DBMS_FGA.ENABLE_POLICY (
object_schema => ‘SCOTT‘,
object_name => ‘EMP‘,
policy_name => ‘mypolicy1‘,
enable => TRUE);
end;
select * from dba_fga_audit_trail;
select * from dba_audit_policies;
select db_user,timestamp,sql_text,sql_bind from dba_fga_audit_trail; --审计结果
SELECT text FROM dba_Views where view_name=upper(‘DBA_FGA_AUDIT_TRAIL‘); --查看记录
----删除策略
begin
dbms_fga.drop_policy (
object_schema=>‘SCOTT‘,
object_name=>‘EMP‘,
policy_name=>‘mypolicy1‘
);
end;
----增加策略
begin
DBMS_FGA.ADD_POLICY (
object_schema => ‘SCOTT‘,
object_name => ‘EMP‘,
policy_name => ‘mypolicy1‘,
handler_schema => NULL,
handler_module => NULL,
enable => TRUE,
statement_types => ‘INSERT, UPDATE,DELETE‘,
audit_column_opts => DBMS_FGA.ANY_COLUMNS);
end;
----启用策略
begin
DBMS_FGA.ENABLE_POLICY (
object_schema => ‘SCOTT‘,
object_name => ‘EMP‘,
policy_name => ‘mypolicy1‘,
enable => TRUE);
end;
select * from dba_fga_audit_trail;
select * from dba_audit_policies;
select db_user,timestamp,sql_text,sql_bind from dba_fga_audit_trail; --审计结果
SELECT text FROM dba_Views where view_name=upper(‘DBA_FGA_AUDIT_TRAIL‘); --查看记录
----删除策略
begin
dbms_fga.drop_policy (
object_schema=>‘SCOTT‘,
object_name=>‘EMP‘,
policy_name=>‘mypolicy1‘
);
end;
oracle 细粒度审计使用
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。