The backup set holds a backup of a database other than the existing 'MyDB'

  • I'm trying to restore a database from our production server to my local machine using the following script but still get the error, 'The backup set holds a backup of a database other than the existing 'MyDB' database.

    USE [master]

    RESTORE DATABASE [MyDB]

    FROM DISK = 'C:\MyDB.bak'

    WITH

    REPLACE,

    MOVE 'MyDB' TO 'C:\MyDB.mdf',

    MOVE 'MyDB_log.ldf'

    GO'

  • The command is somewhat incomplete, it is missing the correct syntax near move for the log file.

    It should be something more like this

    USE [master]
    RESTORE DATABASE [MyDB]
    FROM DISK = 'C:\MyDB.bak'
    WITH
    REPLACE,
    MOVE 'MyDB' TO 'C:\MyDB.mdf',
    MOVE 'MyDB_Log' TO 'C:\MyDB_log.ldf'
    GO
  • It is possible though that the backup has more than one database inside of it. You can query the file to find out if there's an issue.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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