以scott用戶(hù)的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; --審計(jì)結(jié)果
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;
更多信息請(qǐng)查看IT技術(shù)專(zhuān)欄