Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to Rollback an entire database?


How to Rollback an entire database?

Author
Message
Richard McSharry
Richard McSharry
Valued Member
Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)

Group: General Forum Members
Points: 53 Visits: 134
Hi,

In the worst-case scenario where a critical bug has crept through QA, are there any software tools that assist in helping you rollback a database to a previous version?

I understand you can do a SQLCompare between workingOLD and brokenNEW to see the schema changes, and that you would lose any data entered in new tables, but if that was acceptable loss does anyone have any pointers?

Could you simply write a script that went through each table and copied the data from brokenNEW to workingOLD for each object in workingOLD?

Has anyone ever done this/have experience of it? Any pitfalls if so?

Thanks,
Richard
GSquared
GSquared
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: 14363 Visits: 9729
Do you have the scripts that were used to roll in the schema updates? If so, are they reversible?

When I roll out any major database change, I make sure I have a rollback script available before-hand.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)

Group: Administrators
Points: 35873 Visits: 18715
You could use Red Gate's Data Compare as well, but what you're talking about is a custom job. There's no easy way for a tool to make the decisions about how to move data. If you've added or removed columns, what happens to the data?

Follow me on Twitter: @way0utwestForum Etiquette: How to post data/code on a forum to get the best help
PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3093 Visits: 4639
Richard McSharry (10/15/2010)
In the worst-case scenario where a critical bug has crept through QA, are there any software tools that assist in helping you rollback a database to a previous version?


Isn't this the definition of "restore"?

_____________________________________
Pablo (Paul) Berzukov

Author of Understanding Database Administration available at Amazon and other bookstores.

Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)

Group: Administrators
Points: 35873 Visits: 18715
I would have thought so, but if people entered data in a new system, you can't restore without losing that data. So you need to migrate backwards the data.

Follow me on Twitter: @way0utwestForum Etiquette: How to post data/code on a forum to get the best help
jeff.mason
jeff.mason
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1153 Visits: 2125
Steve Jones - SSC Editor (10/15/2010)
I would have thought so, but if people entered data in a new system, you can't restore without losing that data. So you need to migrate backwards the data.


I have never seen a good way to do this without customized scripts to merge data sets. Generally speaking most places I have worked commit to go forward in some fashion once an app is deployed and passed for users to work in; I have never seen a rollback at noon on Monday. Better to fix the problem than to go back to an older DB and try and migrate the data to the old restore.
cdesmarais 49673
cdesmarais 49673
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1163 Visits: 1423
I've written lots of rollback scripts as part of deployments to deal with this, but (furious knocking on wood) I've never actually had to use one.

There isn't going to be a magic bullet. You are going to have to identify each schema change and figure out how to map the new data to the old. Hopefully you can just get away with throwing away new columns, but when you get into more complex relationships it can get VERY messy.

Best case, you have a source control of the SQL scripts that were deployed. Otherwise you are going to have to use redgate or equivalent against a backup.
PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3093 Visits: 4639
Steve Jones - SSC Editor (10/15/2010)
I would have thought so, but if people entered data in a new system, you can't restore without losing that data. So you need to migrate backwards the data.


or... you can perhaps

1- Detach affected database
2- Move affected database datafiles to a different location
3- Attach affected database as bad_db
4- Restore db point-in-time until the moment of the tragic event.
5- Add "good" data from bad_db into restored db

_____________________________________
Pablo (Paul) Berzukov

Author of Understanding Database Administration available at Amazon and other bookstores.

Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
jeff.mason
jeff.mason
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1153 Visits: 2125
PaulB-TheOneAndOnly (10/15/2010)
Steve Jones - SSC Editor (10/15/2010)
I would have thought so, but if people entered data in a new system, you can't restore without losing that data. So you need to migrate backwards the data.


or... you can perhaps

1- Detach affected database
2- Move affected database datafiles to a different location
3- Attach affected database as bad_db
4- Restore db point-in-time until the moment of the tragic event.
5- Add "good" data from bad_db into restored db


Isn't that another way of saying the same thing?
PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3093 Visits: 4639
jeff.mason (10/15/2010)
PaulB-TheOneAndOnly (10/15/2010)
Steve Jones - SSC Editor (10/15/2010)
I would have thought so, but if people entered data in a new system, you can't restore without losing that data. So you need to migrate backwards the data.


or... you can perhaps

1- Detach affected database
2- Move affected database datafiles to a different location
3- Attach affected database as bad_db
4- Restore db point-in-time until the moment of the tragic event.
5- Add "good" data from bad_db into restored db


Isn't that another way of saying the same thing?


Don't think so.
So far I've heard about rolling out bad data while keeping good data until reaching the point where database was kosher.
Proposed approach is to start with a kosher database then add "good" data generated after the "tragic event". ;-)

_____________________________________
Pablo (Paul) Berzukov

Author of Understanding Database Administration available at Amazon and other bookstores.

Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
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