{"id":124,"date":"2012-03-12T10:53:44","date_gmt":"2012-03-12T10:53:44","guid":{"rendered":"https:\/\/sqlserverlearner.azurewebsites.net\/2012\/03\/12\/start-stop-restart-sql-server-2008-from-command-prompt\/"},"modified":"2012-03-12T10:53:44","modified_gmt":"2012-03-12T10:53:44","slug":"start-stop-restart-sql-server-2008-from-command-prompt","status":"publish","type":"post","link":"https:\/\/sqlserverlearner.com\/2012\/03\/12\/start-stop-restart-sql-server-2008-from-command-prompt\/","title":{"rendered":"START STOP RESTART SQL Server 2008 from command prompt"},"content":{"rendered":"

Following commands can be used to start stop SQL Server service from command prompt.
\nNote: <\/strong>Run Command prompt as Administrator<\/p>\n

Start SQL Server 2008<\/strong><\/p>\n

[sourcecode language=”plain”]net start mssqlserver[\/sourcecode]<\/p>\n

\"\"<\/a>
Start SQL Server 2008 - mssqlserver service from Command Prompt<\/figcaption><\/figure>\n

Stop SQL Server 2008<\/strong><\/p>\n

[sourcecode language=”plain”]net stop mssqlserver[\/sourcecode]<\/p>\n

\"\"<\/a>
STOP SQL Server 2008 - mssqlserver service from Command Prompt<\/figcaption><\/figure>\n

Restart SQL Server 2008<\/strong><\/p>\n

[sourcecode language=”plain”]
\nnet stop mssqlserver
\nnet start mssqlserver
\n[\/sourcecode]<\/p>\n

Advanced Topics:<\/strong>
\nIf you want to start\/Stop a specific sql server instance replace mssqlserver with the name of the instance specific service[sourcecode language=”plain”]
\nnet stop <<sqlserverservicename>>
\nnet start <<sqlserverservicename>>
\n[\/sourcecode]<\/p>\n

For SQL Server Express the name would be MSSQL$SQLEXPRESS
\n[sourcecode language=”plain”]
\nnet stop MSSQL$SQLEXPRESS
\nnet start MSSQL$SQLEXPRESS
\n[\/sourcecode]<\/p>\n

How to find the service name?<\/strong>
\n1. Open Services.msc (open Run (windowskey+r) then type services.msc and click on ok)
\n2. In the read through the services(or click S to find all services starting with s)
\n3. Select a SQL Server service and doubleclick on it(or rightcick-properties)
\n4. In the popup you will have service name
\n5. Note down the service name (This is the name of the service – Display name is used for readability)<\/p>\n

\"\"<\/a>
SQL Server Service Pop up<\/figcaption><\/figure>\n

Following are the few of SQL Server related service names:<\/strong><\/p>\n\n\n\n\n\n\n\n\n\n\n
Display Name<\/th>\nService Name<\/th>\n<\/tr>\n
SQL Server (MSSQLSERVER)<\/td>\nMSSQLSERVER<\/td>\n<\/tr>\n
SQL Server Agent (MSSQLSERVER)<\/td>\nSQLSERVERAGENT<\/td>\n<\/tr>\n
SQL Server Analysis Services (MSSQLSERVER)<\/td>\nMSSQLServerOLAPService<\/td>\n<\/tr>\n
SQL Server Browser<\/td>\nSQLBrowser<\/td>\n<\/tr>\n
SQL Server Integration Services 10.0<\/td>\nMsDtsServer100<\/td>\n<\/tr>\n
SQL Server Reporting Services (MSSQLSERVER)<\/td>\nReportServer<\/td>\n<\/tr>\n
SQL Server VSS Writer SQLWriter<\/td>\nSQLWriter<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

Following are the few of SQL Server instance specific service names:<\/strong><\/p>\n\n\n\n\n\n
Display Name<\/th>\nService Name<\/th>\n<\/tr>\n
SQL Server (SQLEXPRESS<\/td>\nMSSQL$SQLEXPRESS<\/td>\n<\/tr>\n
SQL Server Agent (SQLEXPRESS)<\/td>\nSQLAgent$SQLEXPRESS<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

Additional Notes:<\/strong>
\nIf you try to start the SQL Server service which is already started you get the below error:<\/em>
\n
\nThe requested service has already been started.
\nMore help is available by typing NET HELPMSG 2182.
\n<\/font><\/p>\n

If you try to stop the SQL Server service which is not yet started you get the below error:<\/em>
\n
\nThe SQL Server (MSSQLSERVER) service is not started.
\nMore help is available by typing NET HELPMSG 3521.
\n<\/font><\/p>\n

If you try to start or stop SQL Server service when you do not have permissions you get the following error:<\/em>
\n
\nSystem error 5 has occurred.
\nAccess is denied.
\n<\/font>
\nResolutions:
\n1- Try to open command prompt as Administrator if it is not running in Admin mode.
\n2- Try to get Admin permissions on the Server.<\/p>\n

If you try to start or stop SQL Server service when you do not have service installed you get the following error:<\/em>
\n
\nThe service name is invalid.
\nMore help is available by typing NET HELPMSG 2185.
\n<\/font>
\nResolutions:
\n1. Check if SQL Server is installed on the server
\n2. Try to open command prompt as Administrator if it is not running in Admin mode.
\n3. Try to get Admin permissions on the Server.
\n2- Try to get Admin permissions on the Server.<\/p>\n

Unable to start\/stop any SQL Server sevice:<\/em><\/strong>
\n1. Check if the service name is correct.
\nYou can use services.msc or use the command
\n[sourcecode language=”plain”]
\nsc query | findstr \/I “MSSQL”
\n[\/sourcecode]
\n2. Check if the Command prompt is in Admin mode
\n3. Check SQL Server error logs for additional details<\/p>\n","protected":false},"excerpt":{"rendered":"

Following commands can be used to start stop SQL Server service from command prompt. Note: Run Command prompt as Administrator Start SQL Server 2008 [sourcecode language=”plain”]net start mssqlserver[\/sourcecode] Stop SQL Server 2008 [sourcecode language=”plain”]net stop mssqlserver[\/sourcecode] Restart SQL Server 2008 [sourcecode language=”plain”] net stop mssqlserver net start mssqlserver [\/sourcecode] Advanced Topics: If you want to…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,610],"tags":[793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889],"_links":{"self":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/124"}],"collection":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/comments?post=124"}],"version-history":[{"count":0,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/124\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/media?parent=124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/categories?post=124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/tags?post=124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}