SQL-Server: The backup set holds a backup of a database other than the existing

前端 未结 24 1777
天命终不由人
天命终不由人 2020-12-07 06:49

I am trying to restore a SQL Server backup file for my database, but it is throwing an error as follow:

The backup set holds a backup of a database ot

相关标签:
24条回答
  • 2020-12-07 07:30

    I was just trying to solve this issue.

    I'd tried everything from running as admin through to the suggestions found here and elsewhere; what solved it for me in the end was to check the "relocate files" option in the Files property tab.

    Hopefully this helps somebody else.

    0 讨论(0)
  • 2020-12-07 07:31

    I was trying to restore a production database to a staging database on the same server.

    The only thing that worked in my case was restore to a new blank database. This worked great, did not try to overwrite production files (which it would if you just restore production backup file to existing staging database). Then delete old database and rename - the files will keep the new temp name but in my case that is fine.

    (Or otherwise delete the staging database first and then you can restore to new database with same name as staging database)

    0 讨论(0)
  • 2020-12-07 07:33

    First create a blank database of the same name. Then go for the restore option

    Under Options on the left pane don't forget to select

    • Overwrite the existing database
    • Preserve the replication settings

    enter image description here

    That's it

    0 讨论(0)
  • 2020-12-07 07:33

    Some of you have highly over complicated this. I found this to be extremely simple.

    1) Create a database with the same name as your .bak file database name !Important

    2) right click the database | Tasks > Restore > Database

    3) Under "Source for restore" select "From Device"

    4) Select .bak file

    5) Select the check box for the database in the gridview below

    6) Under "Select a Page" on the right Select "Options"

    7) Select the checkbox labeled "Preserve the replication settings(WITH KEEP_REPLICATION)

    Now Go back to the General page and click OK to restore the database...That is it.

    0 讨论(0)
  • 2020-12-07 07:35

    Either:

    1) Use WITH REPLACE while using the RESTORE command (if using the GUI, it is found under Options -> Overwrite the existing database (WITH REPLACE)).

    2) Delete the older database which is conflicting and restore again using RESTORE command.

    Check the link for more details.

    0 讨论(0)
  • 2020-12-07 07:35

    I got work done through alternate way, using Generate scripts. That did work for me as Backup-Restore didn't help to resolve the issue due to same error.

    0 讨论(0)
提交回复
热议问题