以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技术专栏