When you attempt it you get the error below.
This can create an issue because the backup wants to restore to its original file location. The error isn't really very helpful.
To recreate the issue:
- Backup database DBOriginal1 to DBO1.bak
- Right click on database you want to restore to and select Restore > Restore Files & Groups.
- In the Source for Restore section, select From Device. Click the ... button and select the DBO1.bak file.
- On the Options page, tick the box Overwrite the existing database (WITH REPLACE).
- Click OK
- The backup set holds a backup of a database other than the existing database.
Using the wizards built into SQL Server Management Studio (SSMS) seems to be inaccurate and often they have bugs.
To get around this we have two options.
The simplest option is, on the Options Page of the Restore wizard, we need to change the Restore Database Files as:
- In the Restore Database Files as: area, change the Restore as name to the name of the new database (DBO2.mdf, DBO2_log.ldf)
- Click OK.
- This will push the backup to the correct database. Not sure why you have to tell the Wizard the exact path of the files, even after selecting the database we want to restore to.
The other option is to create a SQL script to restore the files. Personally i prefer this option as you know exactly what is happening and you can see what you are going to do. I don't trust the wizards very much :p
Hope this helps someone else!