Shortcuts for Starting, Stopping and Restarting SQL Server Service

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.

    Advertisements

    About Dattatrey Sindol (Datta)

    Datta is a Microsoft BI Enthusiast, passionate developer, and a blogger. View Full Profile

    Posted on February 13, 2011, in Shortcuts, SQL Server, SSAS, SSIS, SSRS, Tips 'N' Tricks, Windows. Bookmark the permalink. Leave a comment.

    What are your thoughts?

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s