-1

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.

enter image description here

M P
  • 13
  • 3

2 Answers2

0

If this is with SSMS , you can rclick the database name on the new or same server and use the restore ( or could be labelled backup, bad memory) and follow the wizard renaming where necessary. This is using the standard .bak file.

If this is azure you can import the tier application to another named DB also.

Skint
  • 1
  • 2
0

I think I figured it out by using the "Overwrite the existing database (WITH REPLACE) under the Options tab.

M P
  • 13
  • 3