AUDIT_ARCHIVE procedure and table function - Archive audit log file
The AUDIT_ARCHIVE procedure and table function both archive the audit log file for the connected database.
Syntax
The schema is SYSPROC.
The syntax is the same for both the procedure and table function.
Procedure and table function parameters
- directory
- An input argument of type VARCHAR(1024) that specifies the directory where the archived audit file(s) will be written. The directory must exist on the server and the instance owner must be able to create files in that directory. If the argument is null or an empty string, the default directory is used.
- member
- An input argument of type INTEGER that specifies a valid database member number. Specify -1 for the current database member, NULL or -2 for an aggregate of all members.
Authorization
Execute privilege on the AUDIT_ARCHIVE procedure or table function.
Default PUBLIC privilege
None
Examples
Example 1: Archive the audit log(s) for all members to the default directory using the procedure.
CALL SYSPROC.AUDIT_ARCHIVE(NULL, NULL)
Example 2: Archive the audit log(s) for all members to the default directory using the table function.
SELECT * FROM TABLE(SYSPROC.AUDIT_ARCHIVE('', -2)) AS T1
Information returned
Column name | Data type | Description |
---|---|---|
DBPARTITIONNUM | SMALLINT | dbpartitionnum - Database partition number monitor element |
PATH | VARCHAR(1024) | Directory location of archived file. |
FILE | VARCHAR(1024) | Name of the archived file. |
SQLCODE | INTEGER | The SQLCODE received while attempting to archive file. |
SQLSTATE | VARCHAR(5) | The SQLSTATE received while attempting archive file. If SQLSTATE is NULL, the value is zero. |
SQLERRMC | VARCHAR(70) FOR BIT DATA | The sqlerrmc received while attempting archive file. If SQLSTATE is NULL, the value is zero. |
MEMBER | SMALLINT | member - Database member monitor element |