Scheduling autonomic statistics monitoring

You can schedule maintenance activities that run automatically to maintain accurate and up-to-date statistics in Db2.

Before you begin

Your authorization ID must have execute privileges for the ADMIN_TASK_ADD stored procedure.

The authorization ID that you specify in the call to the ADMIN_TASK_ADD stored procedure must have ADMIN_UTL_MONITOR stored procedure.

Procedure

Begin program-specific programming interface information.To schedule autonomic statistics monitoring:

Call the ADMIN_TASK_ADD stored procedure to schedule calls to the ADMIN_UTL_MONITOR stored procedures in the administrative task scheduler.

Examples

The following examples show the relevant values that you might specify in the call to the ADMIN_TASK_ADD stored procedure:
Monitor statistics, excluding the catalog database, every day at 1 a.m.
The following option values define the described schedule:
point-in-time
pstmt.setString(7, "0 1 * * *");
procedure-name
pstmt.setString(13, "ADMIN_UTL_MONITOR");
procedure-input
pstmt.setString(14, "SELECT 'statistics-scope=profile,restrict-ts=\"DBNAME <> ''DSNDB06''\"', 0, 0 ,'' FROM SYSIBM.SYSDUMMY1");
Monitor statistics for the SYSTSKEY catalog table space on the first day of each month at 1 a.m.
The following option values define the described schedule:
point-in-time
pstmt.setString(7, "0 1 1 * *");
procedure-name
pstmt.setString(13, "ADMIN_UTL_MONITOR");
procedure-input
pstmt.setString(14, "SELECT 'statistics-scope=profile, restrict-ts=\"DBNAME = ''DSNDB06'' AND NAME =''SYSTSKEY''\"', 0, 0 ,'' FROM SYSIBM.SYSDUMMY1");

End program-specific programming interface information.