Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
adidas_kid
Starting Member
1 Post |
Posted - 2006-05-18 : 15:33:39
|
I am trying to schedule the shutdown of SQL. I use the net stop in a .cmd file. The problem I am running into is there are dependancies that also need to be stopped. When run from a command line, it asks if I want to shutdown the other services. How do I pass a "Y" and Enter into the .cmd file?Stopping the other services first is not an option...Thanks |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-05-18 : 15:38:55
|
net stop mssqlserver /yTara Kizeraka tduggan |
 |
|
Kristen
Test
22859 Posts |
Posted - 2006-05-19 : 00:52:56
|
Or you could NET STOP the other services first - that will be more important if you are planning to also restart them with NET START because starting the main service will not usually start the ancilliary services.Here's what I use to "cycle" the SQL Services:@ECHO OFFECHO.ECHO This will Stop, and then Restart, SQL Services. press Control-C to abortECHO.PAUSEECHO ----- Ignore "Folder already exists ..."MD C:\LogFilesECHO ----- END IgnoreECHO.ECHO ---------- >>C:\LogFiles\RestartServices.LOGECHO Stop >>C:\LogFiles\RestartServices.LOGDATE /T >>C:\LogFiles\RestartServices.LOGTIME /T >>C:\LogFiles\RestartServices.LOGECHO.ECHO Stopping SQL services ...ECHO.NET STOP "SQLSERVERAGENT" /YNET STOP "MSSQLSERVER" /YECHO.ECHO Ready to restart services - press Control-C to abort (with services STOPPED)PAUSEECHO.ECHO Starting SQL services ...ECHO.NET START "MSSQLSERVER"NET START "SQLSERVERAGENT"ECHO ---------- >>C:\LogFiles\RestartServices.LOGECHO Start >>C:\LogFiles\RestartServices.LOGDATE /T >>C:\LogFiles\RestartServices.LOGTIME /T >>C:\LogFiles\RestartServices.LOGECHO ========== >>C:\LogFiles\RestartServices.LOGECHO.ECHO Services Restart completedPAUSE Kristen |
 |
|
azmi
Starting Member
37 Posts |
Posted - 2006-05-19 : 10:49:53
|
Very usefull batch files,i really do use this files.Thnks kristen. I will use this batch files to run in my schedule period.. |
 |
|
|
|
|