Hello. The default location for storing audits is the SYSAUX
tablespace. Since this tablespace is used for other system-related extents, it is recommended to move the audit location to a different tablespace:
Create a new tablespace:
CREATE TABLESPACE AUDIT_TBS;
Change the default audit location with the following command:
BEGIN
DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION(
AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
AUDIT_TRAIL_LOCATION_VALUE => 'AUDIT_TBS'
);
END;
/
Next, create a job to automatically purge old audits:
BEGIN
DBMS_AUDIT_MGMT.CREATE_PURGE_JOB(
AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
AUDIT_TRAIL_PURGE_INTERVAL => 7,
AUDIT_TRAIL_PURGE_NAME => 'PURGE_UNIFIED_AUDIT_TRAIL',
USE_LAST_ARCH_TIMESTAMP => TRUE,
CONTAINER => DBMS_AUDIT_MGMT.CONTAINER_ALL
);
END;
/
If the CONTAINER
line is omitted, the default value CURRENT_CONTAINER
is used.
This method ensures that audit logs are automatically purged every 7 days, eliminating the need for manual configurations.