Hi There,

Thank You for visiting my blog. I have moved this blog to a new address http://dattatreysindol.com/. Please visit the blog at new address and re-point your feeds to the new address to continue to receive regular updates.
Thanks,
Dattatrey Sindol (Datta)

Datta's Ramblings on Business Intelligence 'N' Life

Shortcuts for Starting, Stopping and Restarting SQL Server Service

» 13 Feb 2011 | | |

Often we control the state of the services running on the local computer like Starting, Stopping and Restarting the services. This applies to the various services associated with SQL Server as well like SQL Server Service, SQL Server Agent, and SQL Server Integration Services etc.

It is a good practice to stop or disable those SQL Server related services which are not in use; like let us say you are working on a reporting project and dealing only with SQL Server Database Engine and SQL Server Reporting Services then you can keep the other services like SQL Server Analysis Services, SQL Server Integration Services etc. either stopped or disabled to improve the system performance.

Here is the normal approach used by many people to navigate to the services and Start/Stop/Restart a particular service.
  • Navigate to the Services Window using one of the following approaches:
    • Go to Start -> Control Panel -> Administrative Tools -> Services
    • Go to Start -> Run... -> Type services.msc and Click OK
    • Press Windows Key + R Key to bring up Run... window and Type services.msc and Click OK
  • Select the service which you want to Start/Stop/Restart and Right-Click
  • Select appropriate option from context menu like Start/Stop/Restart or Select Properties to open the Properties window.


As we can see that the above approaches are multi-step approaches simply to Start, Stop or Restart a service. The same thing can be achieved in a simple single-step processed by doing some preparations for the first time.
  1. Open a new Notepad
  2. Type NET STOP "SQL Server (MSSQLSERVER2K8R2)"
  3. Save the Notepad to your desktop as StopSQLServer.bat
  4. Now simply double-click on StopSQLServer.bat every time you want to Stop the SQL Server Service.
In the above step 2, replace "SQL Server (MSSQLSERVER2K8R2)" with the exact name of your SQL Server or related service (refer to the screenshots above for the name of the SQL Server Service).

Similarly, create separate batch files for Starting and Restarting the SQL Server Service using the following command (s) in each of the batch files.

StartSQLServer.bat
NET START "SQL Server (MSSQLSERVER2K8R2)"

RestartSQLServer.bat
NET STOP "SQL Server (MSSQLSERVER2K8R2)"
NET START "SQL Server (MSSQLSERVER2K8R2)"

Again, in these batch files, replace "SQL Server (MSSQLSERVER2K8R2)" with the exact name of your SQL Server or related service (refer to the screenshots above for the name of the SQL Server Service).

It's just a 5-10 minutes of work for the first time and just a couple of seconds thereafter to Start/Stop/Restart your SQL Server and related services.

Reference: http://msdn.microsoft.com/en-us/library/ms187463.aspx

Note: This demonstration is based on SQL Server 2008 R2 and Windows XP Operating System.

Readers Feedback:
Did you like this article?
If Yes, then please share it:
Did you like my blog?
If Yes, then please help spread the word by sharing this blog with your colleagues, friends, & anyone else in the MSBI Space: Like us on Facebook , Follow us on Twitter .

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

About the Author

Dattatrey Sindol is a BI Tech Lead & a passionate SQL Server Developer in a leading IT company.  read more »
Connect with Datta:

Thank You Visitors!

Hi There, Thanks for Visiting my Blog. Please feel free to leave your Comments/Suggestions about any of my Articles/My Blog.

Do Not Copy this Blog's Content !

Protected by Copyscape Online Copyright Checker