Re: Script to stop a SQL service



Would the syntax be the same if I ran the command line script from within a
batch file?

I'm planning on running this batch file from within the BackUp Exec
software. I have two database programs that run SQL services, preventing
the backup jobs from doing a thorough job. Automatically shutting down
those SQL services will allow jobs to complete properly.


"Dan Guzman" <guzmanda@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:Blyxe.3037$cb6.823@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> You can use the NET STOP and NET START commands from the command-prompt to
> stop/start any Windows service. For a default SQL Server instance:
>
> NET STOP MSSQLSERVER
> NET START MSSQLSERVER
>
> For a named instance:
>
> NET STOP MSSQL$MyInstance
> NET START MSSQL$MyInstance
>
> You can also use SQL-DMO to stop/start a SQL Server instance. VbScript
> Examples:
>
> 'stop example
> Option Explicit
> Dim oSQLServer
> Set oSQLServer = CreateObject("SQLDMO.SQLServer")
> oSQLServer.Name = "MyServer"
> oSQLServer.Stop
>
> 'start example
> Option Explicit
> Dim oSQLServer
> Set oSQLServer = CreateObject("SQLDMO.SQLServer")
> oSQLServer.Start False, "MyServer"
>
> --
> Hope this helps.
>
> Dan Guzman
> SQL Server MVP
>
> "Paul O. Morris" <pomorris@xxxxxxxxxxx> wrote in message
> news:K8GdnQw9easBP1vfRVn-gg@xxxxxxxxxxxxxx
>> Is there a script that I can run to stop a particular SQL server service
>> on Win2003 server? I'm looking for a similar script to restart that
>> service as well. Thanks.
>>
>>
>
>


.



Relevant Pages

  • Re: log off command
    ... I simply execute the batch file and let them play... ... If it's by the hour you don't need a script. ... You can logoff a sessionname or a session ID in each case you have to ... Is it possible to issue the command from user1's logon to logoff ...
    (microsoft.public.windowsxp.basics)
  • Re: log off command
    ... I simply execute the batch file and let them play... ... If it's by the hour you don't need a script. ... You can logoff a sessionname or a session ID in each case you have to ... Is it possible to issue the command from user1's logon to logoff ...
    (microsoft.public.windowsxp.basics)
  • Re: Command or setting to force monitor on?
    ... Keystrokes vbs script? ... But the same symptoms as without cscript, monitor not waking up, when I ... I set up a batch file containing the commands to first start IE, ... could move to the keystrokes command. ...
    (microsoft.public.windowsxp.general)
  • Re: Scheduled script problem
    ... A vbs script that sets up a command to run a batch file, calls EXEC on the ... until the scheduler stops the script after the maximum allowed time to run. ...
    (microsoft.public.windows.server.scripting)
  • Re: Scheduled script problem
    ... A vbs script that sets up a command to run a batch file, calls EXEC on the ... until the scheduler stops the script after the maximum allowed time to run. ...
    (microsoft.public.windows.server.scripting)