Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2010

    Unanswered: Problem Restoring Backup / Change Physical File Name in Backup File

    Hi there,

    I have a MS SQL Server 2008 backup file (*.bak) which I'd like to use to copy a database to another MS SQL Server 2008 manually. I'm using the following command:

    restore database [name]
    from disk = 'C:\backup.bak'
    file = 1,
    move 'name' to 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\name.mdf',
    move 'name_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\name_log.ldf ',

    Unfortunately, this doesn't work. The physical file name in the backup file points to drive E: because the database is stored on drive E: on the other machine. I always get the error that SQL couldn't access E:\...\name.mdf. I basically don't understand why SQL tries to access E: while the backup file is saved on C:. Shouldn't the physical file name from the backup file be irrelevant? Does anyone have an idea how to solve this problem? Unfortunately, I don't have a drive E: on the current machine, so it seems like I need to change the physical file location information in the backup file somehow...

    Last edited by jan--; 12-29-10 at 10:28.

  2. #2
    Join Date
    Jul 2003
    San Antonio, TX
    Make sure you specify the paths and logical file names correctly (restore filelistonly will help you). Also, you don't need REPLACE if you're restoring to an instance where that database doesn't exist.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  3. #3
    Join Date
    Nov 2010
    Oh, you have been absolutely right... I have used the from name. Thanks a lot
    Last edited by jan--; 12-29-10 at 12:19.

Posting Permissions

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