Scheduling log and alert history cleanup for autonomic statistics
When you automate statistics maintenance, Db2 stores logs and historical alert information. You can schedule autonomic cleanup and removal of these records.
Before you begin
The following prerequisites are met:
- For scheduling the cleanup, your authorization ID has execute privileges for the ADMIN_TASK_ADD stored procedure, and the authorization ID that you specify in the call to the ADMIN_TASK_ADD stored procedure has execute privileges for the ADMIN_UTL_MODIFY stored procedure.
- When invoking the cleanup manually, your authorization ID has execute privileges on the ADMIN_UTL_MODIFY stored procedure.
About this task
Db2 logs information about autonomic statistics activities in the SYSIBM.SYSAUTOALERTS and SYSIBM.SYSAUTORUNST_HIST catalog tables. The activity logs include summary and detailed reports about generated alerts and the associated executions of the autonomic stored procedures.
Procedure
To schedule cleanup activities for the logs and alert histories for autonomic statistics:
Add a single task that executes the ADMIN_UTL_MODIFY stored procedure to the administrative
task scheduler.
The following example shows the relevant values that you might specify in the call to the
ADMIN_TASK_ADD stored procedure to schedule the removal of log and alert history data that is older
than thirty days, on the first day of every month:
- point-in-time
pstmt.setString(7, "0 0 1 * * ");
- procedure-name
pstmt.setString(13, "ADMIN_UTL_MODIFY");
- procedure-input
pstmt.setString(14, SELECT 'history-days=30', 0, 0, '' FROM SYSIBM,SYSDUMMY1");
You can specify the frequency of the execution and other options by defining the task
properties.