Can't start Sql 7 Server from DMO

  • I can *stop* the Server using (VBScript):

    Dim oSQLServer

    Set oSQLServer = CreateObject ("SQLDMO.SQLServer")

    oSQLServer.LoginSecure = True

    strSQLServerName = "bills0"

    oSQLServer.Connect strSQLServerName

    oSQLServer.ShutDown

    oSQLServer.Disconnect

    but when I try restarting it using

    Set oSQLServer = CreateObject("SQLDMO.SQLServer")

    strSQLServerName = "bills0"

    oSQLServer.Start vbFalse

    I get Error: [SQL-DMO] Service Control Error: The RPC Server is unavailable. Code 800A06BA

    It's complaining because the server I want to start is down. Duh! Any thoughts on how to address this one?

    Bill

  • Try:

    oSQLServer.Start vbFalse, strSQLServerName

    Andy

  • Thanks Andy,

    That did the trick. The documentaiton mislead me.

    >>>

    Start Method (SQLServer)

    The Start method starts the Microsoft® SQL Server™ 2000 service, optionally connecting the SQLServer object on successful start.

    Applies ToSQLServer Object

    Syntax

    object.Start( StartMode , [ Server ] , [ Login ] , [ Password ] )

    Server

    Optional. A string that specifies an instance of SQL Server started by name.

    >>>

    Well it wasn't optional after all.

    Bill

  • The reason its optional is that you can set the name separately & before making the call to the start method. The optional parameters on the start method let you do it one vs having to set a couple properties first.

    Andy

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply