Sql-server – How to implement a quick backup and restore strategy for database script testing

backuprestoresql serversql-server-2008

I've got a copy of our 130GB production database restored on our development SQL Server 2008 R2 Standard Edition 64-bit.

I'm developing some test scripts, which need to de-duplicate a lot of data that has been created in error, so I've got a copy of the database in order to develop and test the de-duplication scripts.

The full restore just took 45 minutes and I want to be able to test my script, then quickly restore the database back to the initial state, then fix any issues with my script and re-test the improved database script.

Since I'm not on Enterprise Edition snapshot backups is not available to me.

What backup and restore strategy could I use to prevent this 45 minute bottleneck? If there is one available, please can you suggest a script for the backup and restore?

Best Answer

Since you are limited by Edition, I agree with @MartinSmith that you can use Dev edition (to create snapshot and revert when you have to rollback) since you are only testing and no one is connecting or using the data except you - provided you have enough space and memory. Also, I assume that 130GB is compressed backup !

Also, restoring a 130 GB database takes 45 mins .. you need to check if Instant file initialization is enabled or not (should be enabled). Also, you can play with BUFFERCOUNT and MAXTRANSFERSIZE parameters.