start sql agent 2005 with t sql

  • hello ,

    i have a job which start every one minute , i want to before my job start verify with t sql if sql agent is running , if not start sql agent 2005 automatically

    thank you for your help.

  • That's a chicken-egg problem. If the Agent is not started your job won't start, and therefore won't be able to check and start the service 🙂

    If you want to check to see if the Agent is running, and start it if it is not running, then you could use Windows Task Scheduler with a PowerShell script to do that...but whatever you decide it will have to run outside Agent.

    Why is Agent stopped? Is it not set to start automatically when the server starts? Is the service failing for some reason or is someone stopping it? If the service is failing you could set the service to attempt to restart itself whenever it fails via the Windows Services interface.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply