Solved

How to start the mssqlserver by using xp_cmdshell

Posted on 2007-03-17
4
664 Views
Last Modified: 2007-03-19
Hi,
How can I restart the mssqlserver and sqlserveragent in QA?
I try with this command exec master..xp_cmdshell 'net start msssqlserver' but there is an option Yes or not which I do not know how to enter the values
0
Comment
Question by:motioneye
  • 2
4 Comments
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 100 total points
ID: 18740461
>How can I restart ...
you cannot restart SQL Server from within itself. trying to do so would result in an error.
you could only try to schedule a restart using command line (at.exe) or vbscript file.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 18740471
Do this from the Command line:
net start MSSQLSERVER
net start SQLSERVERAGENT
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 18740476
Also, just friendly reminder but the following questions are now considered abandoned, please attend to them:
1 02/28/2007 500 sql server cou at 100% and wil... Open MS SQL Server
2 02/22/2007 500 SQL DTS error, how to troubles... Open MS SQL DTS
3 01/11/2007 500 How to find the root of blocki... Open MS SQL Server
0
 
LVL 16

Accepted Solution

by:
rboyd56 earned 400 total points
ID: 18740534
From a logical standpoint. SQL Server has to be rujning in order to connect via Query Analyzer. Therefore, you cannot start SQL Server using Query Analyzer, just as angellll indicated.

You can in fact stop SQL Server using Query Analyzer using the SHUTDOWN command
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now