I need to take a backup of my production database and restore it to the test database. I'm not sure the best way to do this, as I keep getting errors when I try to use the backup and restore functions within SSMS. So basically I have 2 databases and need to use one to restore to the other.
ProductionDB - Backup this database
TestDB - Restore the backup to this database and overwrite any data in this database. Any transactions that happened on ProductionDB after the backup happened are not important.
Right now I can probably do it by deleting TestDB and then restoring ProductionDB to a new database called TestDB, but I'm sure there's a more "proper" way to do it.
Edit: The errors I'm getting are as followed.
When I use the SSMS GUI to restore the ProductionDB (using the .bak file) to the TestDB. I get an error saying the database is in use. I then take the ProductionDB & TestDB offline and get the following error:
The backup set holds a backup of a database other than the existing '5TEST' database.