solving sql server problems for millions of dbas and developers since 2006



SQL Server DBA Tips SQL Server Developer Tips SQL Server Business Intelligence Tips SQL Server Career Tips SQL Server Tip Categories SQL Server Tutorials SQL Server Webcasts SQL Server Whitepapers SQL Server Tools SQL Server Questions and Answers MSSQLTips Authors About MSSQLTips SQL Server User Groups MSSLQTips Giveaways MSSQLTips Advertising Options

MSSQLTips Facebook Page MSSQLTips LinkedIn Page MSSQLTips RSS Feed MSSQLTips Twitter Page MSSQLTips Google+ Page





Start, Stop, Pause and Query Windows SQL Server Services Remotely

By: | Read Comments (2) | Print

Jugal has 8+ years of extensive SQL Server experience and has worked on SQL Server 2000, 2005, 2008 and 2008 R2.

Related Tips: More

Problem

Sometimes SQL Server services or any other Windows service does not start due to some issue after a server reboot. When you try to login to the server you find that you do not have remote login rights to that server or remote login is disabled for that server. Here is a solution to start the service remotely. This tip is also useful if you want to start a number of services in a particular order.

Solution

To control the services remotely, we can use either the services.msc GUI or the SC (Service Control) command to start, query, stop, create and delete any Windows service remotely. The SC command is very useful when remote login is disabled and we want to start the service.

Permissions

You can set permissions for individual services by using Security Templates or using Security Policy.


Using the GUI - Services.msc

The first option is to use the Services application to control the services on a remote server. Type services.msc in the run window or go to Control Panel -> Administrative Tools -> Services. When this app opens, click on the Action menu and click on "Connect to another computer...".

Sometimes SQL Server services or any other Windows service does not start due to some issue after a server reboot

Enter the remote computer name as shown below and it will load the services of the remote machine. Once you connect you can manage the services as your normally do.

The first option is to use the Services application to control the services on a remote server


Using Command Prompt

The other option is to use the command line tool SC.exe.

Basic Syntax for SC.exe

SC [\\server] [command] [service name] [Options]

To get a list of options you can run sc /? as shown below. The below image lists the commands you can use with SC.

The other option is to use the command line tool SC.exe.

Example 1 - Start the SQL Server Service

This command will start the SQL Server service on server "\\computer100".

sc \\computer100 START "mssqlserver"

This command will start the SQL Server service on server "\\computer100".

Example 2 - Stop the SQL Server Service

This command will stop the SQL Server service on server "\\computer100".

sc \\computer100 STOP "mssqlserver"

This command will stop the SQL Server service on server "\\computer100".

Next Steps

  • Use the other command options and check the output
  • Create a batch file to start the different services using the SC command
  • When running this make sure you have the correct permissions to start and stop the services otherwise you will get an "Access is denied" error message.
  • When running the SC command on Vista, Windows 7, Windows 2008, etc... you may need to open the CMD prompt with the "Run as administrator" option.
  • Read more about the SC command


Related Tips: More | Become a paid author


Last Update: 8/26/2010

Share: Share 






Comments and Feedback:

Wednesday, September 08, 2010 - 12:05:11 PM - Gennadiy Chornenkyy Read The Tip
Very helpful - thanks!


Wednesday, February 15, 2012 - 4:40:25 AM - sumi Read The Tip
hi, while connecting remote machine using the above commend i'm getting OpenSCManger failed. Access denied. Thanks, Sumi


Post a Comment or Question

Keep it clean and stay on the subject or we may delete your comment.
Your email address is not published. Required fields are marked with an asterisk (*)

*Name   *Email   Notify for updates
Comments
*Enter Code refresh code


 
New SQL Monitor v3.0

New SQL Monitor v3.0


Sponsor Information
"SQL doctor is the best SQL product on the market, by far. All of Idera's tools are great, but this is the icing on the cake!"

It takes just 5 minutes to connect your SQL Databases to source control. Got 5 minutes? Get started now.

Need SQL Server help and not sure where to turn? Reach out to expert consultants for a Health Check.

Find and Fix SQL issues with Foglight Performance Analysis. Get a free copy.

Solving SQL Server problems for millions of DBAs and Devs since 2006. Join now.

Valuable SQL Server web casts on Performance Tuning, Development, Administration, SSIS and more...


Copyright (c) 2006-2012 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | about
authors | contribute | feedback | giveaways | user groups
Some names and products listed are the registered trademarks of their respective owners.


Edgewood Solutions LLC | MSSharePointTips.com | MSSQLTips.com