Re: Automatically stopping an SQL Service
From: Bob Day (BobDay_at_TouchTalk.net)
Date: 04/20/04
- Next message: Andrea Montanari: "Re: n00b Question Re: MSDE SQL Server Install"
- Previous message: Jorge Rosa: "WRONG OS OR OS VERSION FOR APLICATION"
- Next in thread: Ashish Ruparel [MSFT]: "Re: Automatically stopping an SQL Service"
- Reply: Ashish Ruparel [MSFT]: "Re: Automatically stopping an SQL Service"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 20 Apr 2004 12:08:09 -0500
Running Windows XP with lastest MSDE...
Thanks for your help. Getting close, but still having a problem. For the
following setup:
Computer Name: D98K8H41
Instance Name: CSOLUTION
Windows Logon: ComServer (we are using windows
authentication)
Password: (no password) (don't worry, no password
is only for development system)
The command line (which I believe it correct - I have tired other
variations, but get the same error message):
osql -S D98K8H41\CSOLUTION -U ComServer -P -Q Shutdown
returns the following error:
Logon failed for user 'ComServer'. Reason: Not associated with a
trusted SQL server connection.
However, loged on as ConServer, the following command works and shutdown the
SQL Server:
osql -S D98K8H41\CSOLUTION -E -Q Shutdown
Question 1) Why did the first command not work?
Question 2) How would the technique be used to shut down a server across the
network on another machine? It would also be loged on as ComServer (with a
password).
Tried variations of this, but got the same error as above:
Computer Name: D32GCG31
all othe items the same, except Password: XXX
osql -S \\D32GCG31\CSOLUTION -U ComServer -P XXX -Q Shutdown
Thanks!
Bob Day
"Ashish Ruparel [MSFT]" <v-ashrup@microsoft.com> wrote in message
news:nCrql70IEHA.3812@cpmsftngxa06.phx.gbl...
> Hi Bob,
>
> You can stop the SQL Server from the Command prompt.
> There are two ways of achieving the same.
>
> First is to use the OSQL utility and execute the Shutdown command of the
> particular SQL Server/SQL Server Named instance that you desire to
> shutdown. The syntax for it is
>
> osql -S <ServerName> -U <LoginID> -P <Password> -Q Shutdown
>
> Please make note that the parameters are Case Sensitive.
>
> <Servername> - Will be the server instance that you wish to shutdown
> <LoginID> - will be the user with the appropriate privilege
> <Password> - will be the password for that user
>
> You can include this in a bat file and it will shut down the SQL server
and
> Quit from the OSQL prompt.
>
>
> Second method is to use the Net Stop command. But, stopping of the
default
> instance of SQL Server from the command prompt works only if you are
> running Microsoft Windows NT® 4.0 or Windows® 2000
>
> The syntax for Net Stop command is
>
> Net Stop <ServerName>
>
> <ServerName> can be mssqlserver for the default instance of the SQL Server
> or mssql$instancename for named instance, replace instancename with the
> Name of the instance of the SQL Server that you wish to shutdown.
>
>
>
> You can include this in a bat file too.
>
>
> Further information on shutting down the SQL server can be found from the
> following link
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad
> _1_start_6628.asp
>
> Example for shutting down using net stop command can be found at
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/howtosql/ht
> _startp_3nxw.asp
>
> Example for shutting down using Shutdown statement can be found at
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_
> setu-sus_90ab.asp
>
> More information on the OSQL utility can be found at
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/coprompt/cp
> _osql_1wxl.asp
>
>
> HTH
>
> Ashish
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
- Next message: Andrea Montanari: "Re: n00b Question Re: MSDE SQL Server Install"
- Previous message: Jorge Rosa: "WRONG OS OR OS VERSION FOR APLICATION"
- Next in thread: Ashish Ruparel [MSFT]: "Re: Automatically stopping an SQL Service"
- Reply: Ashish Ruparel [MSFT]: "Re: Automatically stopping an SQL Service"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|