Let's suppose that we are planning to execute a "risky action" on a database. Naturally we've tested on non-production databases and everything seems to be fine. We backup the database. Then we execute the risky action. After some number of additional transactions, we realize a horrible mistake. Now we'd like to "undo" the risky action but maintain the subsequent transactions.
I am aware that crisis tools exist that will help undo transactions based on transaction logs. Since I don't actually have a crisis, I am curious about whether this can be accomplished without those tools in the right situation.
I have in mind that something like the following could be accomplished, but I don't know whether it's actually possible on SQL Server.
Timeline of our invented crisis
- Make full backup of database (B)
- Execute risky action (T1)
- Transaction 2 occurs (T2)
- ...
- Transaction n occurs (Tn)
- Realize that we need to undo T1.
"Undo"
- Restore B into a new database (B')
- Somehow apply T2 through Tn to B'
Is this something that can be done with built-in commands? I've tagged SQL Server 2008 since that is the package I most frequently use. However, if a solution also works on SQL Server 2005 (or only on 2008 R2), I'd like to hear about that too.
