Restoring From Another Dev’s MDF on Same Database: MDF Cannot be Overwritten

Here is the situation:

We have multiple developers. We want to import/export(restore/backup) .bak files whilst working on the same, but local, databases(Each dev has a local instance of DB: A).

The problem is as follows:

I try to do a BACKUP DATABASE and generate a .bak. The other dev receives this .bak and tries to RESTORE DATABASE using the MOVE statements to change to paths of the .mdf/.ldf‘s as they might be different. The problem is that it will complain about the .mdf/.ldf‘s being unoverwriteable, even though they are from the same database as the .bak.

Is there a way to do what we want? It has to be done through sqlcmd. It would also be a plus if we can have the .bak not replace the database but rather “merge” with it.

We are using MS SQL Express 2008 R2.

If any additional information is needed, just ask.

Thanks!

Answer

I logged off and back on and it seems to no longer throw the error.

Attribution
Source : Link , Question Author : Moo , Answer Author : Moo

Leave a Comment