แสดงบทความที่มีป้ายกำกับ Net command แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ Net command แสดงบทความทั้งหมด

วันอังคารที่ 6 ธันวาคม พ.ศ. 2554

SQL Service Net command



Start and stop batchfile services via a batchfile

Case
Constantly running all Microsoft SQL Services on your development desktop/laptop could be a little too much.Especially when you're not developing, but starting and stopping via the control panel is tiresome...

Solution
You can stop/start a service via the command (or even better, put it in a batchfile):
Syntax
      NET START [service]
      NET STOP [service]
      NET PAUSE [service]
      NET CONTINUE [service] 
   
Key
   service : The service name as shown in Control Panel, Services

Apparently it does not matter whether you use the Service name or the Display name.  

Start batchfile SQL 2005:
@ECHO OFF
NET START "SQL Server (MSSQLSERVER)"
NET START "SQL Server Agent (MSSQLSERVER)"
NET START "SQL Server Integration Services"
NET START "SQL Server Analysis Services (MSSQLSERVER)"
NET START "SQL Server Reporting Services (MSSQLSERVER)"

Stop batchfile SQL 2005:
@ECHO OFF
NET STOP "SQL Server (MSSQLSERVER)"
NET STOP "SQL Server Agent (MSSQLSERVER)"
NET STOP "SQL Server Integration Services"
NET STOP "SQL Server Analysis Services (MSSQLSERVER)"
NET STOP "SQL Server Reporting Services (MSSQLSERVER)"



Start batchfile SQL 2008:
@ECHO OFF
NET START "MSSQLSERVER"
NET START "SQL Server Agent (MsSqlServer)"
NET START "SQL Server Integration Services 10.0"
NET START "MSSQLServerOLAPService"
NET START "ReportServer"

Stop batchfile SQL 2008:
@ECHO OFF
NET STOP "MSSQLSERVER"
NET STOP "SQL Server Agent (MsSqlServer)"
NET STOP "SQL Server Integration Services 10.0"
NET STOP "MSSQLServerOLAPService"
NET STOP "ReportServer"