Home Dashboard Directory Help
Search

SQL Server 2012 SSMS Silently Overwrites DB Name and Can Cause Accidental Overwrites and Data Loss by Greg Low - Australia


Status: 

Active


35
0
Sign in
to vote
Type: Bug
ID: 779190
Opened: 2/13/2013 10:04:26 PM
Access Restriction: Public
0
Workaround(s)
view
7
User(s) can reproduce this bug

Description

I've now seen this scenario at a number of client sites and it's already caused quite a bit of data loss.
It is a common operation for users to want to create a copy of their production databases for test or UAT purposes. In SQL Server 2008 R2, in the Restore Database dialog, they entered the DB name, then entered the location of the file.
In SQL Server 2012, if they enter a target DB name in the dialog, then select the file location, SSMS then silently changes the DB name they have entered with the name of the DB that was backed up. If the customer doesn't notice this silent change (as is often the case), they end up overwriting their original database with an older backup.
Details
Sign in to post a comment.
Posted by HeavenCore on 9/12/2013 at 5:18 AM
This is still doing our head in.

Say we have a live database called "FOO" & we have the need to restore a backup of this database under a different name, let's say "FOO_LASTWEEK" the old versions of SSMS used to automatically change the "Restore As" filenames to match the new name, i.e. "FOO_LASTWEEK.MDF" - however, in 2012 its not doing! If I restore “FOO” as “FOO_LASTWEEK” the "Restore As" filenames remain as "FOO" & we have to manually change the filenames prior to the restore - this is time consuming and clumsy - please bring back the old functionality or at least offer it as an option in SSMS!
Posted by Gavin Reid on 6/5/2013 at 7:57 AM
The restoration behaviour of management studio has changed in a very dangerous way

Now by default any existing database will be OVERWRITTEN!!!
This behaviour is also not reflected in the UI either as the option is to overwrite is unchecked.
Posted by Microsoft on 2/21/2013 at 10:34 AM
Thank you for reporting this issue - we are investigating and will update you when we have more information.

Thanks,

Alex Grach [MSFT SQL SERVER]
Posted by Mr. Wharty on 2/13/2013 at 10:17 PM
It should also be noted that even if you do notice the change and set the Destination Database name correctly, you still need to manually change the “Restore As” file names. In R2 these names used to default to the file names of the database you were restoring too. In 2012 these names default to the files names for the database being restored

i.e. if you were restoring database YourData (with filenames of YourData.dmf and YourData.ldf) over a database called MyData (with filenames of MyData.mdf and MyData.ldf), R2 used to default the “Restore As” file names to MyData.mdf and MyData.ldf however 2012 defaults these names to YourData.dmf and YourData.ldf.
Sign in to post a workaround.