Solved

How to start the mssqlserver by using xp_cmdshell

Posted on 2007-03-17
4
676 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 143

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

679 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