Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Location
    Austin, Tx
    Posts
    2

    Question Unanswered: Restore SQL2000 database using vbscript

    Hello,
    I am trying to use a VBscript thru installshield to restore a sql2000 database. the script (below) worked fine for default instance of database. but with a specific named instance I get error 3201. any ideas? thx - Prasanna
    ------------------------------------
    code:

    dim sql
    dim sqlRest

    on error resume next
    Set sql = CreateObject("SQLDMO.SQLServer")
    sql.LoginSecure = True
    sql.Connect ".\TEST2000"

    Set sqlRest = CreateObject("SQLDMO.Restore")
    sqlRest.Files = "c:\testdb.bak"
    sqlRest.Database = "TESTDB"
    sqlRest.Action = SQLDMORestore_Database
    sqlRest.ReplaceDatabase = True
    sqlRest.SQLRestore sql
    msgbox err.number

  2. #2
    Join Date
    Sep 2002
    Location
    Austin, Tx
    Posts
    2
    Found a solution:

    The backup was created using default instance of SQL2000 and once I used a backup created using the 'TEST2000' instance the script worked. I think you can use the RelocateFiles property of the SQLDMO Restore object to set the location of the data and log files but due to time constraints I could not try that solution.

    -Prasanna

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •