以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;
申明:本教程内容由威凡网编辑整理并提供IT程序员分享学习,如文中有侵权行为,请与站长联系(QQ:254677821)!