Adding a task to the administrative task scheduler
You can use the ADMIN_TASK_ADD procedure to define new scheduled tasks. The parameters that you use when you call the procedure define the schedule and the work for each task.
Before you begin
- Before you can add a task successfully, you must set up the administrative task scheduler. In particular, if the SYSTOOLSPACE table space does not exist, the ADMIN_TASK_ADD procedure returns an SQL0204N error message.
- You must have EXECUTE privilege on the ADMIN_TASK_ADD procedure.
Restrictions
- The administrative task scheduler only executes procedure (also known as stored procedure) tasks. All restrictions that apply to procedures are still in effect.
- The scheduler does not support the execution of procedures that perform a database connection without a specified user ID and password.
- The scheduler can only execute tasks on active databases. The database must be active on all database partitions.
Procedure
- Connect to the database.
- If the task calls a user-defined procedure, issue the appropriate CREATE PROCEDURE statement.
- Determine the schedule for when and how often you want the task to be executed.
- Call the ADMIN_TASK_ADD procedure to schedule the task.
- Commit the changes.
Results
Every five minutes the administrative task scheduler connects to active databases to check for new or updated tasks. It then adds or updates the tasks in the scheduler task lists. At the same time, the scheduler analyzes the task to schedule its next execution.
To retrieve information about the newly created task, use the ADMIN_TASK_LIST administrative view.