I am doing some testing on a dev database. I would like a easy way to roll back to a known state, however due to the size of the database restoring from a backup takes 5 minutes to perform.
The work I want to “Rollback” is distributed over many connections, I can not modify the sql for some of the connections because they are from an app I do not have access to the source (so I can’t just wrap my connections with a giant BEGIN TRANSACTION)
Is there something lighter weight than restoring from a backup but I don’t need to explicitly enable like BEGIN TRANSACTION and also works to roll back work done by connections that have opened, performed it’s work, and closed after the point to rollback to was created?
You can use database snapshots at the beginning and revert to it at the end. You have to however have all connections closed as it is very similar to BACKUP/RESTORE, though it is certainly more lightweight. One way to do it is it kill all the connections before reverting. If your application can reconnect to a database after a connection failure,this should cover what you want to achieve.