Purging audit trail
You can clean up audit data manually or by scheduling clean up job.
Getting ready
To complete this recipe, you'll need a user who has the audit_admin
role (for example, jack
).
How to do it...
- Connect to the database as a user who has the
audit_admin
role (for example,jack
):$ sqlplus jack
- View number of audit records in the unified audit trail before the cleanup:
SQL> select count (*) from unified_audit_trail;
- To perform the manual cleanup, execute:
SQL> exec DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL( AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED)
- To 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 => 24, AUDIT_TRAIL_PURGE_NAME => 'My_Job', USE_LAST_ARCH_TIMESTAMP => TRUE)
- View number of audit records in the unified audit trail after the cleanup:
SQL> select count (*) from unified_audit_trail;
How it works...
By default, USE_LAST_ARCH_TIMESTAMP...