Author |
Topic |
Surajit
Starting Member
5 Posts |
Posted - 2009-05-28 : 05:58:49
|
Hi,Can u tell me what is the best way to shutdown and restart SQL server.Is it possible to do this by query?Please help.Regards,SurajitSurajit Mukherjee |
|
savior faire
Posting Yak Master
194 Posts |
Posted - 2009-05-28 : 07:17:23
|
Check Books Online to see if this can be done with some sort of command line script.Talk sense to a fool and he calls you foolish. |
 |
|
savior faire
Posting Yak Master
194 Posts |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-05-28 : 09:16:36
|
You can use SSMS to do this.Right click the server node in Object explorer and choose restart. E 12°55'05.63"N 56°04'39.26" |
 |
|
savior faire
Posting Yak Master
194 Posts |
Posted - 2009-05-28 : 09:44:07
|
Peso, I believe the poster is looking for an automated way to do this on some sort of schedule.Talk sense to a fool and he calls you foolish. |
 |
|
Surajit
Starting Member
5 Posts |
Posted - 2009-05-29 : 02:00:45
|
Savior,This is through batch file and i am aware of this.I want to shutdown/restart the server's instance from query in a time when i want to do the same.Do we have any way in SQL server for this?Surajit Mukherjee |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-05-29 : 03:48:36
|
in your bat file, writenet stop mssqlservernet start mssqlserver E 12°55'05.63"N 56°04'39.26" |
 |
|
dmaxj
Posting Yak Master
174 Posts |
Posted - 2011-02-15 : 12:01:20
|
Is there anyway to determine the SQL Server instance names from the command line - just in case 'mssqlserver' is not the default? |
 |
|
dmaxj
Posting Yak Master
174 Posts |
Posted - 2011-02-15 : 13:12:25
|
Perhaps, I should clarify -Is there a way to assign SQL Server instance name(s) to command line argument(s)? |
 |
|
dmaxj
Posting Yak Master
174 Posts |
Posted - 2011-02-15 : 16:05:03
|
So, I have come across being able to use the following code, with hopes of just extracting the InstanceName:C:>SQLCMD -Q "SELECT SERVERPROPERTY('InstanceName')"In theory, this should work but, I only get lots of blank lines, dashes and (1 rows affected) with a NULL at the end.Any clues on why I am not getting the instance name? |
 |
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2011-02-15 : 16:30:30
|
You can easily shutdown SQL Server from a query. Lookup the SHUTDOWN command in books online.However, once SQL Server is shut down there is no way to connect to the instance to restart it. You have to issue the start command from a command line, the services applet or configuration manager.Jeff |
 |
|
dmaxj
Posting Yak Master
174 Posts |
Posted - 2011-02-15 : 21:51:26
|
jeffw8713, the prob is about extracting the sql service instance name from cmd line...no java or any other layers - thank you. |
 |
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2011-02-16 : 16:52:34
|
@dmaxj - I was not responding to your request, but now I see that you started a new topic on an existing old thread.I apologize for answering the original question that was asked...Jeff |
 |
|
|