|
课程第48次:2016-07-15星期五
审计中的1.强制审计
2.标准审计
3.细粒度审计
2016-07-15_standard_mandatory.sql:
- select * from dba_audit_trail order by 5 desc;
- select * from DBA_AUDIT_SESSION order by 5 desc;
- select * from dba_obj_audit_opts;
- select * from dba_priv_audit_opts order by 3;
- select * from dba_stmt_audit_opts
- minus
- select * from dba_priv_audit_opts order by 3;
- ---
- alter user sysman identified by oracle_4U;
- alter user dbsnmp identified by oracle_4U;
- ----
- noaudit drop any table ;
- audit drop any table by hr by access whenever successful;
- select * from dba_priv_audit_opts order by 3;
- ---
- select * from dba_sys_privs p where p.grantee='HR';
- grant drop any table to hr;
- ---
- alter user sh identified by sh account unlock;
- ----
- select * from dba_views v where v.view_name='DBA_AUDIT_TRAIL';
- select count(*) from dba_audit_trail
- union all
- select count(*) from aud$;
- ----
- create tablespace tbsaudit datafile size 20M
- autoextend on ;
- alter table aud$ move tablespace tbsaudit ;
- -----
- select * from v$xml_audit_trail order by 6 desc ;
- ---
- select * from dba_common_audit_trail order by 6 desc ;
- ---
- select * from dba_sys_privs p where p.grantee='HR';
- ---
- grant select any table to hr;
- audit select any table by hr by session whenever successful;
- select * from dba_priv_audit_opts order by 3;
- ----
- select * from dba_common_audit_trail order by 6 desc ;
- select * from v$xml_audit_trail order by 6 desc ;
- ----
- select * from dba_obj_audit_opts;
- select * from v$xml_audit_trail order by 6 desc ;
- ---
- select * from dba_stmt_audit_opts
- minus
- select * from dba_priv_audit_opts order by 3;
- audit table by hr by access whenever successful;
复制代码
2016-07-15_fga.sql:
- select * from dict
- where table_name like 'DBA%POLICIES%';
-
- select * from
- DBA_AUDIT_POLICY_COLUMNS;
-
- select * from
- DBA_AUDIT_POLICIES;
-
- ---
- select
- user,
- sys_context('userenv','current_user') ,
- sys_context('userenv','session_user') ,
- sys_context('userenv','ip_address') ,
- sysdate,
- sys_context('userenv','ip_address') ,
- sys_context('userenv','authentication_type')
- from dual;
-
- create table tfga ( a varchar2(2000))
- tablespace tbsaudit;
-
-
-
-
-
-
-
-
- CREATE OR REPLACE PROCEDURE procfga
- ( object_schema VARCHAR2, object_name VARCHAR2, policy_name VARCHAR2 )
- AS
- begin
- insert into tfga values( user||' '||
- sys_context('userenv','current_user')|| ' '||
- sys_context('userenv','session_user')||' '||
- sys_context('userenv','ip_address') ||' '||
- to_char( sysdate,'YYYY-MM-DD:HH24:MI:SS')||' '||
- sys_context('userenv','ip_address')||' '||
- sys_context('userenv','authentication_type') ||' '||object_schema||' '||
- object_name||' '||policy_name
-
- );
- end;
- select * from user_errors;
-
复制代码
|
|