The CREATE_PURGE_JOB procedure is used to create 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 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 to be created. For more information, see Audit trail types of DBMS_AUDIT_MGMT. |
| audit_trail_purge_interval | The time interval (in hours) at which the purge process is called. A smaller value indicates a more frequent purge. |
| audit_trail_purge_name | The name of the purge job. |
| use_last_arch_timestamp | Specifies whether to use the last archive timestamp to determine which records to delete. Valid values:
TRUE. |
Considerations
This procedure calls the CLEAN_AUDIT_TRAIL procedure to execute the audit trail record purge operation at the specified time interval.
Examples
The following example calls the CREATE_PURGE_JOB procedure to create a purge job named MyCLEANUP for the operating system (OS) audit trail type. The purge job is called every 72 hours, and all audit records created before the last archive timestamp will be deleted.
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;