The CREATE_PURGE_JOB procedure creates a purge job to periodically delete 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.CREATE_PURGE_JOB(
audit_trail_type IN PLS_INTEGER,
audit_trail_purge_interval IN PLS_INTEGER,
audit_trail_purge_name IN VARCHAR2,
use_last_arch_timestamp IN BOOLEAN DEFAULT TRUE) ;
Parameters
| Parameter | Description |
|---|---|
| audit_trail_type | The audit trail type of the purge job. For more information about audit trail types, see Audit trail types. |
| audit_trail_purge_interval | The interval for calling the purge procedure, in hours. The smaller the value is, the more frequently audit trail records are purged. |
| audit_trail_purge_name | The name of the purge job. |
| use_last_arch_timestamp | Specifies whether to delete records based on the last archive timestamp. Valid values:
TRUE. |
Considerations
This procedure calls the CLEAN_AUDIT_TRAIL procedure to purge audit trail records based on the specified interval.
Examples
The following example calls the CREATE_PURGE_JOB procedure to create a purge job named MyCLEANUP for OS audit trail records. The purge job is called every 72 hours to delete all audit records created earlier than the last archive timestamp.
BEGIN
DBMS_AUDIT_MGMT.CREATE_PURGE_JOB(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS,
audit_trail_purge_interval => 72 /*hours*/,
audit_trail_purge_name => 'MyCLEANUP',
use_last_arch_timestamp => TRUE);
END;