|
1. 强制性审计:
- /u01/app/oracle/admin/orcl/adump
复制代码 不能满。
- SQL> conn / as sysdba
- Connected.
- SQL> !ps
- PID TTY TIME CMD
- 14404 pts/2 00:00:00 sqlplus
- 14478 pts/2 00:00:00 ps
- SQL> select p.spid
- 2 from v$session s , v$process p
- 3 where s.paddr=p.addr
- 4 and s.terminal='pts/2';
- SPID
- ------------------------
- 14405
复制代码- -rw-r----- 1 oracle asmadmin 781 10月 16 10:52 orcl_ora_25495_1.aud
- -rw-r----- 1 oracle asmadmin 781 10月 16 10:58 orcl_ora_9708_2.aud
- -rw-r----- 1 oracle asmadmin 781 10月 16 10:58 orcl_ora_9709_2.aud
- -rw-r----- 1 oracle asmadmin 770 10月 16 16:56 orcl_ora_6719_2.aud
- -rw-r----- 1 oracle asmadmin 777 10月 16 16:56 orcl_ora_6719_3.aud
- -rw-r----- 1 oracle asmadmin 783 10月 16 16:56 orcl_ora_6888_1.aud
- -rw-r----- 1 oracle asmadmin 778 10月 16 16:56 orcl_ora_6894_1.aud
- -rw-r----- 1 oracle asmadmin 817 10月 16 16:56 orcl_ora_7039_1.aud
- -rw-r----- 1 oracle asmadmin 819 10月 16 19:30 orcl_ora_14405_1.aud
复制代码 2. 标准审计:
- extended, xml, db_extended, false, true, none, os, db
复制代码
- select s.user_name, s.audit_option from dba_stmt_audit_opts s
- minus
- select p.user_name,p.privilege from dba_priv_audit_opts p;
- select * from dba_priv_audit_opts;
- select * from dba_obj_audit_opts;
- audit select on hr.employees by session whenever successful;
- select * from dba_audit_trail t
- order by t.timestamp desc ;
- select * from dba_views v
- where v.view_name='DBA_AUDIT_TRAIL';
- select t.tablespace_name
- from dba_tables t
- where t.owner='SYS' and t.table_name='AUD
- ;
- create tablespace tbsaudit datafile size 120M autoextend on;
- alter table aud$ move tablespace tbsaudit;
- noaudit create session ;
- truncate table aud$;
- audit create session by hr by access whenever successful;
-
- audit select on hr.employees by session whenever successful;
- audit update on hr.employees by access whenever successful;
- audit table by hr whenever successful ;
- -------------------------------
- select * from v$xml_audit_trail order by 6 desc;
- select * from dba_common_audit_trail c
- where c.db_user='HR'
- order by 6 desc;
复制代码- select * from dba_audit_policies;
- select * from dba_audit_policy_columns;
- create table tfga ( a varchar2(200) ) tablespace tbsaudit;
- CREATE OR REPLACE PROCEDURE
- procfga ( object_schema VARCHAR2, object_name VARCHAR2, policy_name VARCHAR2 )
- AS
- begin
- insert into tfga values ( to_char(sysdate,'YYYY-MM-DD:HH24:MI:SS')||' '||
- sys_context('userenv','ip_address')||' '||
- user||' '||
- sys_context('userenv','current_user')||' '||
- object_schema||' '||
- object_name||' '||
- policy_name);
- end;
- select * from user_errors;
- select * from dba_objects o where o.object_name='PROCFGA';
- begin
- dbms_fga.add_policy(object_schema => 'HR',
- object_name => 'EMPLOYEES',
- policy_name => 'POLICY1',
- audit_condition => 'department_id=20',
- audit_column => 'SALARY,COMMISSION_PCT',
- handler_schema => 'SYS',
- handler_module => 'PROCFGA',
- statement_types => 'SELECT,UPDATE',
- audit_trail => dbms_fga.XML+dbms_fga.EXTENDED,
- audit_column_opts => dbms_fga.ALL_COLUMNS);
- end;
-
- select * from dba_common_audit_trail c
- where c.db_user='HR'
- order by 6 desc;
-
- select * from tfga;
-
-
-
-
-
复制代码 基于值的审计:
- create table tvalue ( a varchar2(200) ) tablespace tbsaudit;
- CREATE OR REPLACE trigger trgvalue
- after update of salary on hr.employees
- referencing new as new old as old
- for each row
- begin
- if :old.salary <> :new.salary
- then
- insert into tvalue values ( to_char(sysdate,'YYYY-MM-DD:HH24:MI:SS')||' '||
- sys_context('userenv','ip_address')||' '||
- user||' '||
- sys_context('userenv','current_user')||' '||
- :old.salary||' '||
- :new.salary
- );
- end if;
- end;
- select * from user_errors;
- select * from dba_triggers t where t.trigger_name='TRGVALUE';
- select * from tvalue;
- select * from tfga;
复制代码
上完1Z0-052 第11章 审计(5/40)
|
|