Oracle 12c : How To Purge The UNIFIED AUDIT TRAIL
Oracle 12c : How To Purge The UNIFIED AUDIT TRAIL
APPLIES TO:
Oracle Database - Enterprise Edition - Version 12.1.0.1 and laterInformation in this document applies to any platform.
GOAL
How to purge the UNIFIED_AUDIT_TRAIL table ?
SOLUTION
The unified audit trail can be purged using the DBMS_AUDIT_MGMT package:
qlplus / as sysdba
SQL> select count(*) from unified_audit_trail;
COUNT(*)
----------
2619
SQL>
COUNT(*)
----------
2619
SQL>
BEGIN
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
use_last_arch_timestamp => FALSE);
END;
/
PL/SQL procedure successfully completed.
SQL> select count(*) from unified_audit_trail;
COUNT(*)
----------
1
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
use_last_arch_timestamp => FALSE);
END;
/
PL/SQL procedure successfully completed.
SQL> select count(*) from unified_audit_trail;
COUNT(*)
----------
1
You can also use the last_arch_timestamp, if you don't want to purge all the audit record and kept the most recent record:
BEGIN
DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS,last_archive_time => TO_TIMESTAMP('10-SEP-0714:10:10.0','DD-MON-RRHH24:MI:SS.FF'));
END;
/
BEGIN
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
use_last_arch_timestamp => TRUE);
END;
/
DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS,last_archive_time => TO_TIMESTAMP('10-SEP-0714:10:10.0','DD-MON-RRHH24:MI:SS.FF'));
END;
/
BEGIN
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
use_last_arch_timestamp => TRUE);
END;
/
Since Unified Auditing caches the audit trail in memory to implement a 'lazy write' feature that helps performance, some of the records eligible for deletion may still linger in the cache, to also first flush this cache add a call to: DBMS_AUDIT_MGMT.FLUSH_UNIFIED_AUDIT_TRAIL; before the call to
dbms_audit_mgmt.clean_audit_trail, this will cause more consistent / expected results.
dbms_audit_mgmt.clean_audit_trail, this will cause more consistent / expected results.
BEGIN
DBMS_AUDIT_MGMT.FLUSH_UNIFIED_AUDIT_TRAIL;
END;
/
DBMS_AUDIT_MGMT.FLUSH_UNIFIED_AUDIT_TRAIL;
END;
/
enable
the Pure Unified Auditing
In order to enable to
Pure Unified Auditing you will need to perform the following steps:
1.
Shutdown your Oracle
Databases and listeners that are associated to the Oracle Home
2.
Relink the Oracle
executable to support the Unified Auditing
3.
Start your Oracle
instances and listener
In order to relink the
Oracle executable you will need to execute the "make" command from
the $ORACLE_HOME/rdbms/lib directory:
make -f ins_rdbms.mk
uniaud_on ioracle
Now, after the relink
has been completed, let's query V$OPTION again to verify that the Unified
Auditing feature is enabled:
SQL> select value
from V$OPTION
where parameter = 'Unified Auditing';
VALUE
-------------------------------------------
TRUE
from V$OPTION
where parameter = 'Unified Auditing';
VALUE
-------------------------------------------
TRUE
References
Wow, great post.
ReplyDeleteReally valuable post. I am waiting for your next post. This post is very valuable and i think it's no need to change. visit website to know more info.
ReplyDeleteThis is quite interesting blog! If you need help in do my general chemistry homework then don't panic and just contact us right now. Our best science specialists are sitting tight for you to help and guide you through comprehension of sub-atomic structures, natural science, inorganic science, standards of connected science, organic chemistry, tips of concoction liberation and each other theme of your science course according to standard grade.
ReplyDeleteDatabase experts are working in the mode that they can develop the right thing for their customer and modify it for the easiness. YOu can also get the sop writing services and apply it in your practical life to achieve the goal.
ReplyDeleteI actually wanna follow it for my website but I need more clearance about this matter. honestly I don't have writing knowledge much more that's why I am trying to follow Google and last I got your site. thanks god. but I got another one website : like yours. can you please visit it and suggest me which one is best useful link
ReplyDeleteComputer languages are difficult one but we really need to know it. This is necessary for the computer users also it is necessary for database users. So thanks for sharing this. https://www.writingaresearchproposal.com/research-proposal-ideas/
ReplyDeleteKnowing about database is one of the important task but yes you can also do it. You just need to follow some of platforms or get a person who is very expert in this field. http://www.grammarsoftware.info/paperrater-com-review/
ReplyDeleteIf anyone is interested in capstone ideas for their college project and thesis then we have best ideas here. In which you can get useful tips regarding their business.
ReplyDeletehow to get free steam games very easy game.
ReplyDelete