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

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

I too came across this issue.

Solution :

  • Dont 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.

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.

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

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

Under Options on the left pane dont forget to select

  • Overwrite the existing database
  • Preserve the replication settings

enter

Thats it

Leave a Reply

Your email address will not be published.