Removing a scheduled task

You can remove a scheduled task from the task list by using the ADMIN_TASK_REMOVE stored procedure.

About this task

Even if a task has finished all of its executions and will never be executed again, it remains in the task list until it is explicitly removed through a call to the ADMIN_TASK_REMOVE stored procedure .
Restrictions:
  • Only the user who scheduled a task or a user with SYSOPR, SYSADM, or SYSCTRL authority can delete a task.
  • A task cannot be removed while it is executing.
  • A task that is the trigger for another task cannot be removed.

Procedure

To remove a scheduled task:

  1. Optional: Issue the following SQL statement to identify tasks that will never execute again:
    SELECT T.TASK_NAME
    FROM TABLE (DSNADM.ADMIN_TASK_LIST()) T,
         TABLE (DSNADM.ADMIN_TASK_STATUS()) S
    WHERE T.TASK_NAME = S.TASK_NAME AND
          (S.NUM_INVOCATIONS = T.MAX_INVOCATIONS OR
           T.END_TIMESTAMP < CURRENT TIMESTAMP) AND
          STATUS <> 'RUNNING'
  2. Confirm the name of the task that you want to remove.
  3. Call the ADMIN_TASK_REMOVE stored procedure. You must provide the task name as a parameter to the stored procedure. The scheduled task is removed from the task list and its last execution status is deleted. Listing the scheduled tasks and execution statuses no longer returns a row for this task. The task name is freed up for future reuse.