Purpose
This function is used to trigger the archiving of the currently writing audit log file and generate a new encryption key when audit log encryption is enabled. Subsequent newly generated archive files will be encrypted using the new key. Typical applications include key rotation or in conjunction with security policy changes.
Applicability
This content applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support the audit feature.
Syntax
AUDIT_LOG_ENCRYPTION_PASSWORD_SET();
Privilege requirements
You must have the SUPER privilege to use this function.
Description
Parameters
This function has no parameters.
Limitations
Like other audit functions (expressions), they must be used directly and exclusively as output columns in a SELECT statement and cannot be used in subqueries. For more information, see the usage limitations and considerations in Overview of audit functions.
Return value
The expression takes no parameters and returns a string.
- When the operation is successfully executed, the expression returns
OK. - When an operation fails, the
SELECTstatement may still execute successfully, with the expression outputting an error message.
Examples
Rotate the key and archive the current audit logs.
SELECT AUDIT_LOG_ENCRYPTION_PASSWORD_SET();
The return result is as follows:
+-----------------------------------------+
| AUDIT_LOG_ENCRYPTION_PASSWORD_SET() |
+-----------------------------------------+
| OK |
+-----------------------------------------+
1 row in set
