Removing a task from the administrative task scheduler

You can remove a scheduled task or task status records from the task list using the ADMIN_TASK_REMOVE procedure.

Before you begin

You must have EXECUTE privilege on the ADMIN_TASK_REMOVE 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 procedure.


Restrictions

  • Successful removal of task and status records depends on the value of the current session authorization ID. The current session authorization ID must match the session authorization ID that was recorded when the task was created. Users with SYSADM, SYSCTRL, SYSMAINT, or DBADM authority can remove any task or status record.
  • Tasks and status records cannot be removed while the task is executing.

Procedure

  1. Connect to the database.
  2. Optional: Issue the following SQL statement to identify tasks that will never execute again:
    SELECT T.NAME
    FROM SYSTOOLS.ADMIN_TASK_LIST T,
         SYSTOOLS.ADMIN_TASK_STATUS S
    WHERE T.NAME = S.NAME AND
         (S.INVOCATION = T.MAX_INVOCATIONS OR
          T.END_TIME < CURRENT TIMESTAMP) AND
          S.STATUS <> 'RUNNING'
  3. Confirm the name of the task or status records that you want to remove.
  4. Call the ADMIN_TASK_REMOVE procedure.
  5. Commit the changes.

Results

If you remove a task, it is removed from the task list of the administrative scheduler. The task name is freed up for future reuse.

You can use the ADMIN_TASK_LIST and ADMIN_TASK_STATUS administrative views to confirm that tasks and task status records have been removed successfully.