Oracle 審計audit 的技巧使用,追蹤oracle後台資料庫的DML動作

來源:互聯網
上載者:User

create or replace package aa_pkg_monitor_business_sql is

  procedure pro_monitor_drop_policy(object_schema in varchar2);
  procedure pro_monitor_add_policy(object_schema in varchar2);

  procedure pro_monitor_drop_main;
  procedure pro_monitor_add_main;

end;
/
create or replace package body aa_pkg_monitor_business_sql is

  /*
  truncate table  sys.fga_log$ ;
  select t.* from dba_fga_audit_trail t;
  */
  procedure pro_monitor_drop_policy(object_schema in varchar2) is
 
    cursor cur_del is
      select owner, table_name from dba_tables a where owner = object_schema;
 
  begin
    for v_cur in cur_del
    loop
      begin
        dbms_fga.drop_policy(object_schema => v_cur.owner, ---
                             object_name => v_cur.table_name, ---
                             policy_name => v_cur.table_name);
      exception
        when others then
          null;
      end;
    end loop;
  end pro_monitor_drop_policy;
  --------------------------------------------------------------------

  --------------------------------------------------------------------
  procedure pro_monitor_add_policy(object_schema in varchar2) is
 
    cursor cur_del is
      select owner, table_name
      from   dba_tables a
      where  owner = object_schema and
             a.table_name not like 'SRP%';
 
  begin
    for v_cur in cur_del
    loop
      begin
        dbms_fga.add_policy(object_schema => v_cur.owner, --
                            object_name => v_cur.table_name, --
                            policy_name => v_cur.table_name,
                            statement_types => 'SELECT,UPDATE,DELETE,INSERT',
                            enable => true);
     
      exception
        when others then
          null;
      end;
    end loop;
  end pro_monitor_add_policy;

  --------------------------------------------------------------------

  --------------------------------------------------------------------
  procedure pro_monitor_drop_main is
  begin
    pro_monitor_drop_policy('CCARE');
    pro_monitor_drop_policy('CRMPUB');
    pro_monitor_drop_policy('INVENTORY');
    pro_monitor_drop_policy('ISAP');
    pro_monitor_drop_policy('OSMS');
    pro_monitor_drop_policy('ECARE');
    pro_monitor_drop_policy('CHANNEL');
  end pro_monitor_drop_main;

  --------------------------------------------------------------------

  --------------------------------------------------------------------
  --------------------------------------------------------------------

  --------------------------------------------------------------------
  procedure pro_monitor_add_main is
  begin
 
    pro_monitor_drop_main;
 
    pro_monitor_add_policy('CCARE');
   -- pro_monitor_add_policy('CRMPUB');
    pro_monitor_add_policy('INVENTORY');
    --pro_monitor_add_policy('ISAP');
    ---pro_monitor_add_policy('OSMS');
 
  end pro_monitor_add_main;

end;
/

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.