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

前端 未结 24 1775
天命终不由人
天命终不由人 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:17

    This helped me to import the back-up file from the system drive

    1. Create a database with the same name(preferably) as your .bak file database name
    2. Right click the database > Tasks > Restore > Database
    3. Under "Source for restore" select "From Device"
    4. Select the .bak file selecting the path from the system
    5. Select the check box for the database in the list box below
    6. Under "Select a Page" on the right Select "Options"
    7. Select the checkbox labeled "Preserve the replication settings(WITH KEEP_REPLICATION)
    8. Select the checkbox for Overwrite the existing database(WITH REPLACE) Now Go back to the General page and click OK to restore the database...
    0 讨论(0)
  • 2020-12-07 07:18

    Before doing anything else, confirm if your backup is Full or Differential. If you're trying to create a new database out of a differential backup, no matter what you do you will encounter the error.

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

    I had to create new db on my local for testing & i had a back up from my prod. I created the db first and tried to run the BAK on top of the new db which produced this error for me. I deleted the db and restored it while sourcing the new db name in the restore screen itself. The db was automatically created on restore.

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

    instead of click on Restore Database click on Restore File and Filegroups..

    thats work on my sql server

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

    I too came across this issue.

    Solution :

    • Don't create an empty database and restore the .bak file on to it.
    • Use 'Restore Database' option accessible by right clicking the "Databases" branch of the SQL Server Management Studio and provide the database name while providing the source to restore.
    • Also change the file names at "Files" if the other database still exists. Otherwise you get "The file '...' cannot be overwritten. It is being used by database 'yourFirstDb'".
    0 讨论(0)
  • 2020-12-07 07:23

    Have facing same problem and found the solution by doing this, using SSMS 2014

    - Just select the Option Overwrite the existing database(WITH REPLACE) 

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