Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002
    Posts
    2

    Unanswered: Restore.RelocateFiles

    Hi,

    I'm trying to restore a *.bak file into a different database.

    Old Database SVW_TEST (from where the *.bak file is):

    SVW_TEST_DATA - d:\SVW_TEST_DATA.mdf
    SVW_TEST_DATA - d:\SVW_TEST_LOG.ldf

    New Database SVW (to restore to):

    SVW_DATA - d:\SVW_DATA.mdf
    SVW_DATA - d:\SVW_LOG.ldf

    I used the following code:


    Dim pRestore As New Restore

    pRestore.Action = SQLDMORestore_Database
    pRestore.Database = "SVW"
    pRestore.ReplaceDatabase = True

    pRestore.Files = "D:\SVW_TEST.bak"

    pRestore.RelocateFiles = "SVW_Test_Data, D:\SVW_DATA.mdf, SVW_TEST_LOG, D:\SVW_LOG.ldf"

    pRestore.SQLRestore pServer


    But it would work: I get an error saying that "The logical file 'SQL' is not part of the SVW-Database". Why 'SQL' ????
    I also tried this version:

    pRestore.RelocateFiles = "SVW_Data, D:\SVW_DATA.mdf, SVW_LOG, D:\SVW_LOG.ldf"

    There I get an error saying that "The logical file 'SVW_DATA' is not part of the SVW-Database".

    Can someone please help.

  2. #2
    Join Date
    Nov 2002
    Posts
    2
    I found the problem myself. I just had to put [] arround the names:

    pRestore.RelocateFiles = "[SVW_Test_Data], [D:\SVW_DATA.mdf], [SVW_TEST_LOG], [D:\SVW_LOG.ldf]"

    eventhough in some examples i found, it was with out them........

Posting Permissions

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