PRB: Autostart Task Fails and Does Not Restart Automatically

ID: Q197096

The information in this article applies to:

SYMPTOMS

If a scheduled task is running in Autostart mode, it should start automatically when the SQLExecutive service is started. However, if a transient or network error causes the task to stop or fail, it is not automatically restarted. This is the expected behavior and this article addresses methods to restart such tasks automatically.

WORKAROUND

Simply restarting the task is not always a solution to the problem. In cases where the real problem is transient (such as a network error or a deadlock), a restart would help. However, in other cases, the failure may occur because of a problem that requires manual intervention. The following workarounds discuss how you can automatically restart an auto-start type task.

To work around this problem and restart the task, do one of the following:

MORE INFORMATION

The following is the sample script for using sp_addalert to configure an alert to restart the task if a failure occurs:

   use msdb
   go
   exec msdb..sp_addalert @name = 'A', @message_id = B,  @enabled = 1,
   @delay_between_responses = 10, @database_name = 'C',
   @notification_message = null, @task_name = 'D',
   @event_description_keyword = 'E', @include_event_description_in
   = 'none', @raise_snmp_trap = 0

The following are the definitions for the parameters used above:

   Parameter variable   Description
   ----------------------------------------------------------------------

   A                    Name of the alert
   B                    Error number reported by the task on failure
   C                    Database name
   D                    Name of the task to restart
   E                    Key words you want to use from the error message

NOTES: Additional query words: prodsql sec SQLExec SEM alrt
Keywords          : SSrvRep 
Version           : WINNT:6.5
Platform          : winnt
Issue type        : kbprb

Last Reviewed: January 6, 1999