萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> oracle教程 >> 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;

copyright © 萬盛學電腦網 all rights reserved