The CLEAN_AUDIT_TRAIL procedure deletes audit trail records.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
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 records to be deleted. For more information about audit trail types, see Audit trail types. |
| use_last_arch_timestamp | Specifies whether to delete records based on the last archive timestamp. Valid values:
TRUE. We recommend that you retain the default value to avoid deleting records unexpectedly. |
Considerations
The CLEAN_AUDIT_TRAIL procedure is usually called after the SET_LAST_ARCHIVE_TIMESTAMP procedure. The SET_LAST_ARCHIVE_TIMESTAMP procedure sets the last archive timestamp of audit records.
Examples
The following example calls the CLEAN_AUDIT_TRAIL procedure to delete all audit trail records that are updated before the last archive timestamp:
BEGIN
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_ALL,
use_last_arch_timestamp => TRUE);
END;