Scenario 6 – Performing Audit Data Cleanup
In this section, we’ll guide you through the process of cleaning up audited data from AUDSYS tables stored in the SYSAUX tablespace.
- Manual Cleanup
You can perform the cleanup manually using the following steps:
- – First, check the count of audited records:
SQL> SELECT COUNT(*) FROM unified_audit_trail;
– Use the following commands to cleanup audit data:
SQL> EXEC DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(AUDIT_TRAIL_TYPE =>
DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED, LAST_ARCHIVE_TIME => SYSDATE);
SQL> EXEC DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
USE_LAST_ARCH_TIMESTAMP => TRUE);
- Scheduled Cleanup
You can also schedule the cleanup for regular execution:
- Set the last archive timestamp:
SQL> EXEC DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(AUDIT_TRAIL_TYPE =>
DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED, LAST_ARCHIVE_TIME => SYSDATE);
– Create a purge job:
SQL> EXEC DBMS_AUDIT_MGMT.CREATE_PURGE_JOB(AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
AUDIT_TRAIL_PURGE_INTERVAL => 1, AUDIT_TRAIL_PURGE_NAME => ‘Audit_Trail_PJ’, USE_LAST_ARCH_TIMESTAMP => TRUE);
- Viewing Cleanup Job Executions
You can view the executions of the cleanup job:
SQL> COL JOB_NAME FORMAT A14
SQL> COL STATUS FORMAT A12
SQL> COL ACTUAL_START_DATE FORMAT A40
SQL> SELECT JOB_NAME, STATUS, ACTUAL_START_DATE FROM dba_scheduler_job_run_details WHERE JOB_NAME = ‘AUDIT_TRAIL_PJ’ ORDER BY ACTUAL_START_DATE;
- Verifying Cleanup
Finally, verify if the audit data has been purged:
SQL> SELECT COUNT(*) FROM unified_audit_trail;
By following these steps, you can effectively perform audit data cleanup in your Oracle database environment.
I just like the helpful information you provide in your articles
This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!
You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
I appreciate you sharing this blog post. Thanks Again. Cool.
Awesome! Its genuinely remarkable post, I have got much clear idea regarding from this post .
I do not even understand how I ended up here, but I assumed this publish used to be great
For the reason that the admin of this site is working, no uncertainty very quickly it will be renowned, due to its quality contents.
I am truly thankful to the owner of this web site who has shared this fantastic piece of writing at at this place.