The CLEAN_AUDIT_TRAIL procedure is used to clean up audit trail records.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
audit_trail_type IN PLS_INTEGER,
use_last_arch_timestamp IN BOOLEAN DEFAULT TRUE);
Parameters
| Parameter | Description |
|---|---|
| audit_trail_type | The type of audit trail to be cleaned. For more information, see Audit trail types of DBMS_AUDIT_MGMT. |
| use_last_arch_timestamp | Specifies whether to determine the records to be cleaned based on the last archival timestamp. Valid values:
TRUE, which is recommended to prevent accidental record cleaning. |
Considerations
The CLEAN_AUDIT_TRAIL procedure is typically called after the SET_LAST_ARCHIVE_TIMESTAMP procedure. The SET_LAST_ARCHIVE_TIMESTAMP procedure is used to set the last archival timestamp of audit records.
Examples
The following example shows how to call the CLEAN_AUDIT_TRAIL procedure to clean up all audit trail records updated before the last archival timestamp.
BEGIN
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_ALL,
use_last_arch_timestamp => TRUE);
END;
