Bo's Oracle Station

查看: 2121|回复: 0

课程第48次:2016-07-15星期五

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2016-7-16 14:47:57 | 显示全部楼层 |阅读模式
课程第48次:2016-07-15星期五
审计中的1.强制审计
             2.标准审计
             3.细粒度审计


2016-07-15_standard_mandatory.sql:
  1. select  * from dba_audit_trail  order by 5 desc;



  2. select  * from DBA_AUDIT_SESSION  order by 5 desc;


  3. select  * from  dba_obj_audit_opts;

  4. select  * from dba_priv_audit_opts  order by 3;

  5. select  * from dba_stmt_audit_opts
  6. minus
  7. select  * from dba_priv_audit_opts  order by 3;


  8. ---
  9. alter user sysman identified by oracle_4U;
  10. alter user dbsnmp identified by oracle_4U;
  11. ----


  12. noaudit drop any table ;

  13. audit drop any table by hr by access whenever successful;

  14. select  * from dba_priv_audit_opts  order by 3;

  15. ---
  16. select  * from dba_sys_privs p where p.grantee='HR';

  17. grant drop any table to hr;
  18. ---

  19. alter user sh identified by sh account  unlock;

  20. ----

  21. select  * from dba_views v where v.view_name='DBA_AUDIT_TRAIL';

  22. select  count(*) from dba_audit_trail
  23. union all
  24. select  count(*)  from aud$;

  25. ----
  26. create tablespace tbsaudit datafile size 20M
  27. autoextend on  ;


  28. alter table aud$ move tablespace tbsaudit ;

  29. -----
  30. select  * from v$xml_audit_trail  order by 6 desc ;

  31. ---


  32. select  * from dba_common_audit_trail  order by 6 desc ;
  33. ---
  34. select  * from dba_sys_privs p where p.grantee='HR';

  35. ---
  36. grant select any table to hr;

  37. audit select any table by hr by session whenever  successful;

  38. select  * from dba_priv_audit_opts  order by 3;

  39. ----

  40. select  * from dba_common_audit_trail  order by 6 desc ;

  41. select  * from v$xml_audit_trail  order by 6 desc ;
  42. ----
  43. select  * from  dba_obj_audit_opts;

  44. select  * from v$xml_audit_trail  order by 6 desc ;


  45. ---
  46. select  * from dba_stmt_audit_opts
  47. minus
  48. select  * from dba_priv_audit_opts  order by 3;


  49. audit table by hr by access whenever successful;

复制代码


2016-07-15_fga.sql:
  1. select  * from dict
  2. where table_name like 'DBA%POLICIES%';

  3. select  * from
  4. DBA_AUDIT_POLICY_COLUMNS;

  5. select  * from
  6. DBA_AUDIT_POLICIES;

  7. ---
  8. select  
  9.      user,
  10.      sys_context('userenv','current_user')  ,
  11.      sys_context('userenv','session_user') ,
  12.      sys_context('userenv','ip_address')  ,
  13.                 sysdate,
  14.      sys_context('userenv','ip_address')  ,
  15.      sys_context('userenv','authentication_type')
  16.      from dual;
  17.      
  18.      create table tfga ( a varchar2(2000))   
  19.       tablespace tbsaudit;








  20. CREATE OR REPLACE PROCEDURE procfga
  21.    ( object_schema VARCHAR2, object_name VARCHAR2, policy_name VARCHAR2 )
  22.    AS

  23. begin
  24.    insert into   tfga  values(   user||' '||
  25.      sys_context('userenv','current_user')|| ' '||
  26.      sys_context('userenv','session_user')||' '||
  27.      sys_context('userenv','ip_address') ||' '||
  28.                to_char( sysdate,'YYYY-MM-DD:HH24:MI:SS')||' '||
  29.      sys_context('userenv','ip_address')||' '||
  30.      sys_context('userenv','authentication_type') ||' '||object_schema||' '||
  31.      object_name||' '||policy_name
  32.    
  33.        );
  34. end;

  35. select  * from user_errors;
复制代码



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-12-5 03:16 , Processed in 0.036295 second(s), 24 queries .

快速回复 返回顶部 返回列表