SQL> SELECT value FROM v$option 2 WHERE parameter='Unified Auditing'; VALUE ------------------- FALSE
即時書込み モード |
すべての監査レコードが監査証跡に即座に書き込む。 データベースのパフォーマンスに影響する場合があり。 3秒に1度、SGAキューの85%を超えた場合に書き込む。 |
---|---|
キュー書込み モード (デフォルト) |
監査レコードをメモリーにキューし、AUDSYSスキーマ監査表に定期的に書き込む。SGAのキューサイズは、UNIFIED_AUDIT_SGA_QUEUE_SIZE初期化パラメータで指定可能。デフォルトのサイズは1MBで、1から30の範囲。 |
AUDIT_ADMIN | 監査ポリシーの作成、削除、変更、結果の確認 DBMS_AUDIT_MGMT,DBMS_FGAのEXECUTE権限 |
---|---|
AUDIT_VIEWER | 監査結果の確認 |
STATEMENT | 実行されるたびに監査ログを取得 |
---|---|
SESSION | 1セッションで1度だけ監査ログを取得 |
INSTANCE | インスタンスが起動中1度だけ監査ログを取得 |
SQL> CREATE AUDIT POLICY test1_policy 2 PRIVILEGES CREATE SESSION,DROP ANY TABLE; Audit policy created.
SQL> CREATE AUDIT POLICY test2_policy 2> ACTIONS SELECT,DELETE ON HR.EMPLOYEES 3> WHEN 'SYS_CONTEXT(''USERENV'',''SESSION_USER'') = ''HR''' 4> EVALUATE PER SESSION; Audit policy created.
SQL> CREATE AUDIT POLICY test3_policy 2> ROLES IMP_FULL_DATABASE, EXP_FULL_DATABASE; Audit policy created.
SQL> CREATE AUDIT POLICY test4_policy 2 PRIVILEGES CREATE SESSION,DROP ANY TABLE 3 ACTIONS SELECT,DELETE ON HR.EMPLOYEES 4 ROLES IMP_FULL_DATABASE, EXP_FULL_DATABASE 5 WHEN 'SYS_CONTEXT(''USERENV'',''SESSION_USER'') = ''HR''' 6 EVALUATE PER SESSION; Audit policy created.
SQL> SELECT policy_name,audit_condition,audit_option 2 FROM audit_unified_policies 3 WHERE policy_name LIKE '%TEST4%' ORDER BY 1; POLICY_NAME AUDIT_CONDITION AUDIT_OPTION ------------- ------------------------------------------- ----------------- TEST4_POLICY SYS_CONTEXT('USERENV','SESSION_USER')='HR' IMP_FULL_DATABASE TEST4_POLICY SYS_CONTEXT('USERENV','SESSION_USER')='HR' CREATE SESSION TEST4_POLICY SYS_CONTEXT('USERENV','SESSION_USER')='HR' DROP ANY TABLE TEST4_POLICY SYS_CONTEXT('USERENV','SESSION_USER')='HR' DELETE TEST4_POLICY SYS_CONTEXT('USERENV','SESSION_USER')='HR' SELECT 6 rows selected.
SQL> AUDIT POLICY TEST4_POLICY BY hr WHENEVER SUCCESSFUL;
Audit succeeded.
SQL> SELECT * FROM AUDIT_UNIFIED_ENABLED_POLICIES;
USER_NAME POLICY_NAME ENABLED_ SUC FAI
---------- ------------------------------ -------- --- ---
HR TEST4_POLICY BY YES NO
ALL USERS ORA_SECURECONFIG BY YES YES
SESSION | ALTER ANY TABLE, CREATE ANY TABLE, DROP ANY TABLE, CREATE ANY PROCEDURE, DROP ANY PROCEDURE, ALTER ANY PROCEDURE, GRANT ANY PRIVILEGE, GRANT ANY OBJECT PRIVILEGE,GRANT ANY ROLE, AUDIT SYSTEM, CREATE EXTERNAL JOB, CREATE ANY JOB, CREATE ANY LIBRARY, EXEMPT ACCESS POLICY, CREATE USER, DROP USER, ALTER DATABASE, ALTER SYSTEM, CREATE PUBLIC SYNONYM, DROP PUBLIC SYNONYM, CREATE SQL TRANSLATION PROFILE, CREATE ANY SQL TRANSLATION PROFILE, DROP ANY SQL TRANSLATION PROFILE, ALTER ANY SQL TRANSLATION PROFILE, TRANSLATE ANY SQL, EXEMPT REDACTION POLICY, PURGE DBA_RECYCLEBIN, LOGMINING, ADMINISTER KEY MANAGEMENT |
---|---|
ACTIONS | ALTER USER, CREATE ROLE, ALTER ROLE, DROP ROLE, SET ROLE, CREATE PROFILE, ALTER PROFILE, DROP PROFILE, CREATE DATABASE LINK, ALTER DATABASE LINK, DROP DATABASE LINK, CREATE DIRECTORY, DROP DIRECTORY, CREATE PLUGGABLE DATABASE, DROP PLUGGABLE DATABASE, ALTER PLUGGABLE DATABASE, EXECUTE ON DBMS_RLS; |
SQL> SELECT ACTION_NAME,EVENT_TIMESTAMP 2 FROM UNIFIED_AUDIT_TRAIL; ACTION_NAME EVENT_TIMESTAMP ------------------------ --------------------------------- LOGOFF 10-JAN-14 02.21.51.129079 AM LOGOFF 10-JAN-14 02.20.10.001567 AM LOGOFF 10-JAN-14 02.13.26.770127 AM … 38580 rows selected.
SQL> BEGIN 2 DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP( 3 AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED, 4 LAST_ARCHIVE_TIME => '17-02-06 01:00:00'); 5 END; 6 / PL/SQL procedure successfully completed.
SQL> BEGIN 2 DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL( 3 AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED); 4 END; 5 / PL/SQL procedure successfully completed.
SQL> BEGIN 2 DBMS_AUDIT_MGMT.CREATE_PURGE_JOB ( 3 AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED, 4 AUDIT_TRAIL_PURGE_INTERVAL => 12, 5 AUDIT_TRAIL_PURGE_NAME => 'Audit_Trail_PJ', 6 USE_LAST_ARCH_TIMESTAMP => TRUE, 7 CONTAINER => DBMS_AUDIT_MGMT.CONTAINER_CURRENT); 8 END; 9 / PL/SQL procedure successfully completed.
$ cd $ORACLE_HOME/rdbms/lib $ make -f ins_rdbms.mk uniaud_on ioracle
$ cd $ORACLE_HOME/rdbms/lib $ make -f ins_rdbms.mk uniaud_off ioracle
SQL> SELECT value FROM v$option 2 WHERE parameter='Unified Auditing'; VALUE ------------------- FALSE