Thursday, June 27, 2013

Database 12c New Audit Features

Amazing Features on Oracle Database 12c , I will blog everything i tested and check in New Oracle Database 12 , This Time Audit Enhancement :

Create Audit Policy :

SQL> create audit policy test_audit privileges select any table ;
Audit policy created.

Where :
Privileges indicate to What this audit policy will do.

SQL> create audit policy test_audit_object actions select,update, lock on osama.test ;
Audit policy created.

Where 
Actions indicate to DML ,DDL Commands.

Until Now , You only Create Audit Policy Without Enable 

In the below way you enable audit for all users 

SQL> audit policy test_audit ;
Audit succeeded.

SQL> audit policy  test_audit_object ;
Audit succeeded.

Enable Audit On Some Users

SQL> audit policy test_audit by osama;
Audit succeeded.

i want to enable audit but not for all users ;

SQL> audit policy test_audit expect osama;
Audit succeeded.

also whenever successful or not successful still exists 

SQL> audit policy test_audit whenever successful 
Audit succeeded.

SQL> audit policy test_audit Whenever not successful ;
Audit succeeded.


Check Audit :

select POLICY_NAME,AUDIT_CONDITION from audit_unified_policies where POLICY_NAME like '%TEST%';
POLICY_NAME               AUDIT_CONDITION
-----------------                --------------------------
TEST_AUDIT_OBJECT        select 

Check Enable Audit Policy 

select policy_name,user_name from audit_unified_ENABLED_POLICIES ;

POLICY_NAME                   USER_NAME
-----------------                     --------------------------
TEST_AUDIT_OBJECT        SYS
Disable Audit Policy :

SQL> DROP AUDIT POLICY TEST_AUDIT ;
DROP AUDIT POLICY TEST_AUDIT
*
ERROR at line 1:
ORA-46361: Audit policy cannot be dropped as it is currently enabled.
SQL> NOAUDIT POLICY TEST_AUDIT ;
Noaudit succeeded.

SQL> DROP AUDIT POLICY TEST_AUDIT ;
Audit Policy dropped.


Thank you 
Osama mustafa

No comments:

Post a Comment