Restore Database option of Overwrite the existing database status is ignored - by gumpy_

Status : 

  Not Reproducible<br /><br />
		The product team could not reproduce this item with the description and steps provided.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 285885 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 7/2/2007 9:23:58 PM
Access Restriction Public


When restoring a database using Microsoft SQL Server Management Studio, the option to Overwrite the existing database is ignored if left as unchecked.  This means that the database is overwritten without any warning or prompt, which can prove to be very bad in a live environment.
Sign in to post a comment.
Posted by JediSQL on 6/19/2012 at 10:53 AM
I am having this trouble in multiple instances of SQL Server 2008 R2 using T-SQL scripts. In simple recovery model, databases are just overwritten. In full recovery model, it tries to overwrite, but is blocked by this error:

Msg 3159, Level 16, State 1, Line 1
The tail of the log for the database "BackupTestDEJ" has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE statement to just overwrite the contents of the log.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Whether simple or full, if there is an exising database, and the WITH REPLACE option is not set, it should just stop with an error that says something like "Cannot restore over existing database without the WITH REPLACE option. It should not be going ahead and trying and, luckily in the full recovery model, getting blocked by a technical dificulty. Good thing all my production databases are in full mode.

Posted by Adri on 11/24/2009 at 2:18 AM

IMHO it isn't still fixed at all on SQL2005 SP3 (9.0.4053)
I did a restore of database DB1, made on server S1 to an existing database DB2 on testserver S2 WITHOUT the REPLACE and expected an error about overwriting an existing database. However, the RESTORE did overwrite the existing database without any error.

Posted by Microsoft on 2/13/2008 at 3:18 PM

This is issue doesnt repro now. It is fixed.By default "Overwrite the existing database" option is unchecked and we donot generate the "REPLACE" T-SQL option in the RESTORE query.

Posted by Microsoft on 10/31/2007 at 11:58 AM
Hello Gumpy,

Thank you for reporting the problem to us. We understand the danger involved in accidently overwriting existing database. We will try to address this problem in the coming releases of SQL Server.

Thanks again
SQL Server Team