Restore A Live Database to Test Database containing defferent Names using SQL Server Management Studio
Just so you know, this is so much more easily done with T-SQL. Using the GUI for backups and restores is a pain in the bottom.
However, what you need to do to in order to restore a backup from one database on top of a different database is ensure that you're moving the data files from the old databases definitions to the new database. On the screen above, you'll need to change the database name, obviously, for the restore.
Then, you have to click on the Files tab. It's right there in the upper left. That will list out all the files in the current database. It will show their current location. It also has a column called &quot;Restore As&quot; that is defaulted to the current location. You want to change that to be the location of your TestDB, wherever that is.
On the screen above, you also have to click on the Options tab (again, upper left). There, you want to enable &quot;Overwrite existing database (WITH REPLACE)&quot;.
A giant word of caution here. Make darned sure you've got the database named changed in the first screen. If you mess that up, you'll be forcing a restore on top of your production database (which will probably fail because connections will block you, but if it doesn't, oh boy).
Or, you could:
RESTORE DATABASE NewDatbaseName
FROM DISK = 'x:\bu\olddatabase.bak'
WITH REPLACE,
MOVE 'OldDataFile' TO 'd:\data\newdbname.mdf',
MOVE 'OldLogFile' TO 'd:\data\newdbname_log.ldf';

So much easier and more clear. However, to each their own.