SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Weird Issue Restoring DB in SQL 2012


Weird Issue Restoring DB in SQL 2012

Author
Message
Talib123
Talib123
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1371 Visits: 2347
Scenario
Test Server
Database A. Needs to be backed up and restored as Database B.
1 Backup Database A. Fine
2 Restore Backup of A as DATABASE B. Problem.

Although the destination db using the GUI has been changed to DATABASE B and the overwrite existing database is NOT ticked. This has been overwriting DATABASE A even through the overwrite option is not checked. When this is scripted out via the script button on the GUI it states restore database [DATABASE B}.
Workaround has been to rename DATABASE A to DATABASE x, do the restore it restores as DATABASE B correctly. Then return DATABSE X to DATABASE A.

If the original database that was used for the backup doesn’t exist it will create the database correctly with no overwrite. Has anyone seen this before its very strange.
SQL 2012 on WINDOWS 2012.
Cody Konior
Cody Konior
SSC Eights!
SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)

Group: General Forum Members
Points: 989 Visits: 1110
When using the GUI, have it generate a CREATE script for Database A, a CREATE script for Database B, a RESTORE script for Database B, and a RESTORE FILELISTONLY of the backup file. Show us all of this and there will be an answer in there somewhere.

The only thing I can think of is if you detached Database A, and Database B had files pointing to the same location. You restore B without a WITH MOVE clause and it overwrites A's files.
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (94K reputation)SSC Guru (94K reputation)SSC Guru (94K reputation)SSC Guru (94K reputation)SSC Guru (94K reputation)SSC Guru (94K reputation)SSC Guru (94K reputation)SSC Guru (94K reputation)

Group: General Forum Members
Points: 94895 Visits: 33011
Yeah, I'd make sure that you're using WITH MOVE. It could just be that it's overwriting the files... which would only be possible if the database is offline.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Talib123
Talib123
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1371 Visits: 2347
Thanks for the replies, but the dbs are not offline. I am using the GUI not T-SQL. The database nor db files should be able to be overwritten. As long as I change the destination db in the GUI and change the file names it should restore correctly.

If the database name is changed from what it was when the backup was taken it works fine. So it is not the files as they remain the same when the db is renamed. It's a very strange one.

Again my work around for now is to rename the db(Original db_a)the backed up db rename to(db_a1), restore it from the backup file as (db x).
Rename db_a1 back to db_a.

It seems if the origanl db used to create the backup file exists it overwrites it. Even when the option is not selected. This should not be possible. Honestly this is the case.
HowardW
HowardW
SSCertifiable
SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)

Group: General Forum Members
Points: 5955 Visits: 9892
This isn't what you're seeing is it?

http://sqlblog.com/blogs/merrill_aldrich/archive/2013/03/15/ssms-2012-restore-gui-gotcha.aspx
HowardW
HowardW
SSCertifiable
SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)

Group: General Forum Members
Points: 5955 Visits: 9892
Just played around with it myself (don't usually use the GUI very often) and it's pretty misleading.

By default, when selecting a backup file that has the same DB name as one that exists on that server, if you don't go onto the options tab, you'll put your source database in the RESTORING state as it does a tail log backup of it, even if your destination name is different.

It's not actually restoring over the top (you can still bring it back ONLINE), but can see why you'd think it was restoring over the top!
Talib123
Talib123
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1371 Visits: 2347
Yes the link seems to be the issue, this is pretty poor from MS as the overwrite is not ticked so you would expect failure.
I usually use T-SQL for restores, this caught me out as it was supposed to be a quick smash and grab restore for someone in the DEV environment who was struggling to get it done.

THANKS
Cody Konior
Cody Konior
SSC Eights!
SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)SSC Eights! (989 reputation)

Group: General Forum Members
Points: 989 Visits: 1110
Holy cow that article (and more specifically the related Connect item) are crazy, and that they've been sitting there since February with no reply is ridiculous!

On the other hand I now have legitimate reasons to tell businesses that the SQL Server GUI can destroy databases just while trying to restore them, and so they really need my services because I would use T-SQL. Hehe.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search