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


Rolling Back a Restore


Rolling Back a Restore

Author
Message
Steve Cullen
Steve Cullen
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: 1375 Visits: 1226
As an option, I don't think this would be a bad thing, but for some, it could become a crutch.

Before I start a restore action, I always triple-check all my settings before I go. There are some things we do that have serious consequences for mistakes and this is one of them.

But anything that can make it safer would be a positive.

Converting oxygen into carbon dioxide, since 1955.


TheRealYeti
TheRealYeti
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 12
I think, it would be a great thing.

It does not happen very often that the real live database has to be overwritten, so if a proved Script / Command can help to make it less dangerous it is a great thing :-)
Tom Thomson
Tom Thomson
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26281 Visits: 12506
An option to rename the existing db instead of overwriting it might bevery nice, provided it would deal automatically with the required filename changes (can't have two DBs using the same filenames). (So of course would any other way of rolling back restore, prob=vided you could still do it a while after the restore was finished rather than not just until then).

We did something like that when rolling out upgrades (of databases that were read only on customer sites) using DTS (to copy whole databases), and it's clearly applicable in the restore case too. As DTS over a slow internet connection (which some of our customers had) was slow (and even over a fast connection was sufficiently slow to cause noticeable downtime) we always had DTS create a new DB; this also eliminated the possibility of DTS leaving a partly overwritten live DB as the result of a network or other failure. When DTS completed without errors, we would drop the current back copy, rename the current live DB to be the new back copy db, and rename the new db to be the current live db. If we later discovered that someone had dropped a cog and the new live database was not acceptable we could get thinks back up again in a very short time by renaming the live db back to the new db name and renaming the back copy to the live name.

Another point: having restore automatically destry the old db is the restore completed cleanly would be much less valuable than keeping the old DB (in renamed form) for a while, until someone decides it's no longer needed in case of something nasty coming to light.

Unfortunately I can't see any way of making this usable for really big databases.

Tom

Ron Kunce
Ron Kunce
SSC Eights!
SSC Eights! (834 reputation)SSC Eights! (834 reputation)SSC Eights! (834 reputation)SSC Eights! (834 reputation)SSC Eights! (834 reputation)SSC Eights! (834 reputation)SSC Eights! (834 reputation)SSC Eights! (834 reputation)

Group: General Forum Members
Points: 834 Visits: 496
I kind of like the idea as an option only for relatively small databases. But I have to stop and think about it and why the option doesn't already exist. Most of the time whenever I needed to restore a database, it was because the that database had some how become corrupted with bad data, in which case, why would I want to have an option to keep it around in case the restore fails or is canceled? On the other hand why would I want to restore a perfectly good database.

An answer to the second question maybe, to eliminate a large accumulation of temporary or test data and reset it back to a baseline, then this option could be a good thing. Of course a transactional script could do the same thing unless the temp/test data had overwritten the data I want kept.

Possibly the reason that it is not already an option is because it would rarely be needed. Then again it does seem that it is those rare cases that always seem to rise up and bite us in the butt.

Ron K.

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." -- Martin Fowler
Tom Thomson
Tom Thomson
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26281 Visits: 12506
Ron Kunce (3/22/2010)
IPossibly the reason that it is not already an option is because it would rarely be needed. Then again it does seem that it is those rare cases that always seem to rise up and bite us in the butt.

I like those two sentences. The second explains why it would be an extremely good thing to have. And the first explains why MS almost certainly will never provide it.

Tom

matt stockham
matt stockham
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2686 Visits: 3178
If anything, I would rather have the option to take a full, copy-only backup of the existing database as part of the restore (probably as part of the WITH clause).
Steve Jones
Steve Jones
SSC Guru
SSC Guru (149K reputation)SSC Guru (149K reputation)SSC Guru (149K reputation)SSC Guru (149K reputation)SSC Guru (149K reputation)SSC Guru (149K reputation)SSC Guru (149K reputation)SSC Guru (149K reputation)

Group: Administrators
Points: 149276 Visits: 19448
Matt,

Now that is a great idea as well.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
info2rafiq
info2rafiq
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 253
Its Great Idea.

Nowadays space is not an issue. Production data more costlier than space.
Michael Valentine Jones
Michael Valentine Jones
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14867 Visits: 11848
It wouldn’t do anything you can’t do already. You can restore a database with a new name, verify it is OK, drop the old database, and then rename the restored database.

There are so many possible scenarios for a restore that I don’t think it is really that useful. For example, a complete restore up to a point in time of a failure using the full backup and transaction log backups.

I rarely use the GUI for a restore; I find that it’s easier to use a script.
SQLBill
SQLBill
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11839 Visits: 1085
If I have a concern, I detach the existing database and change the extension to .old (ie: mydbname.mdf.old and mydbname.ldf.old). Then I restore from the backup. If anything fails, all I have to do is remove the .old part of the extension and attach the files. Once I know everything is good-to-go, I delete the old files and that frees up the space.

-SQLBill



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