Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003

    Unanswered: Help with SQLDMO RelocateFiles please


    I'm using the SQLDMO Restore object (against SQL Server 7) to restore a database using the RelocateFiles option.


    .RelocateFiles = "[old_logical_filename],[new_physical_filename.mdf]"

    The trouble is, I won't necessarily know the old logical filename. I thought I would be able to read this from the backup header with the QueryResults object returned by .ReadBackupHeader, but I can't see how.

    with :
    - the original database called dbet08 with logical filenames of dbet08_data, dbet08_log
    - backed up to dbet08.bak
    - restored to database name et00012308
    - backed up to et00012308.bak

    In order to restore to a logical name of et00012308 and physical name of et00012308.mdf the relocateFiles option needs to be "[dbet08_data],[c:\data\et00012308.mdf]"

    It must be in there somwhere as enterprise manager reads it & displays it in the backup dialog.

    Anyone know how to do this?

  2. #2
    Join Date
    Apr 2003

    Found it

    Dim objQueryResults As sqldmo.QueryResults

    Set objQueryResults = oRestore.ReadFileList(oSQLServer)
    DBName = objQueryResults.GetColumnString(1, 1)
    LogName = objQueryResults.GetColumnString(2, 1)

Posting Permissions

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