Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql agent auto restart

Status
Not open for further replies.

zxmax

Technical User
Nov 24, 2003
179
CA
Greeting, i'm new to ms sql, and i have a quick question
Is it possible to have the sql server agent to restart automatically if the sql server restart

lets say i want to restart the sql server, it automatically stops the server agent, then after restarting the sql server, the agent DOES NOT start automatically .. is it possible to have the agent to stat automatically >?

Thanks,
 
I think this can be done via the sql agent properties advanced tab from EM. Just check restart service box.
 
Tran008's suggestion may not work in all cases. Here is the way to make sure SQL Server Agent starts whenever the SQL Server services starts ...

One of the problems you may not be aware of when stopping and restarting SQL Server is that, by default, the SQL Server Agent WILL NOT restart when the SQL Server service starts up. This will cause any jobs you have schedule to not run ...

To fix this issue, run the following code in Query Analyzer on the Master DB, on any servers you plan to stop/start SQL Server.


CODE
CREATE PROC AutoStart_SQLServerAgent
AS
EXEC XP_CMDSHELL 'NET START SQLSERVERAGENT'
go
SP_PROCOPTION AutoStart_SQLServerAgent, STARTUP, TRUE

The code above will create the stored procedure AutoStart_SQLServerAgent in the Master DB.

The next command sets the stored procedure to run at the startup of the SQL Server service.

Enjoy!

Thanks

J. Kusch
 
HAHA ... No Doubt! should have just pasted the link instead of the post itself! Ah ... live and learn.

Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top