The SET_LAST_ARCHIVE_TIMESTAMP procedure sets a timestamp indicating the last time audit records were archived. The audit administrator provides a timestamp attached to audit records. The CLEAN_AUDIT_TRAIL procedure uses this timestamp to determine which audit records to delete.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(
audit_trail_type IN PLS_INTEGER,
last_archive_time IN TIMESTAMP,
rac_instance_number IN PLS_INTEGER DEFAULT NULL);
Parameters
| Parameter | Description |
|---|---|
| audit_trail_type | Specifies the audit trail type for the cleanup job. For more information, see Audit trail types. |
| last_archive_time | The TIMESTAMP value indicating the time when audit records or files should be deleted. This value represents the last time audit records or files were archived. |
| rac_instance_number | Specifies the instance number. The default value is NULL. The rac_instance_number parameter is not accepted when audit_trail_type is set to one of the following values:
rac_instance_number to 1. |
Considerations
When the audit trail type is AUDIT_TRAIL_AUD_STD, last_archive_time must be specified as a UTC timestamp. This is because database audit trails store timestamps in UTC format. UTC is also known as Greenwich Mean Time (GMT).
When the audit trail type is AUDIT_TRAIL_OS, last_archive_time must be specified as a timestamp in the local time zone. The time zone must be the one of the machine where the OS audit file was created. This is because OS audit files are cleaned up based on the Last Modification Timestamp attribute. The Last Modification Timestamp attribute value is stored in the local time zone of the machine.
Examples
The following example calls the SET_LAST_ARCHIVE_TIMESTAMP procedure to set the last archive timestamp for an operating system (OS) audit trail type on a specific database instance. It uses the TO_TIMESTAMP function to convert a string to a timestamp value.
Subsequently, the CLEAN_AUDIT_TRAIL procedure is called with use_last_arch_timestamp set to TRUE, which will delete all OS audit files modified before 11:11:11.11 on November 11, 2021, from the current directory.
BEGIN
DBMS_AUDIT_MGMT.SET_LAST_ARCHIVE_TIMESTAMP(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS,
last_archive_time => TO_TIMESTAMP ('2021-11-11 11:11:11.11', 'YYYY-MM-DD HH24:MI:SS.FF')
rac_instance_number => 1);
END;
