Yes, you create a database snapshot of the 'clean' state then every hour you revert the 'dirty' database from the clean snapshot. See:
While other methods also exists (backup/restore, detach/attach and copy files etc) the snapshot based one is probably the fastest because snapshots are diferential based at the file system (they use Sparse Files). If your database in 'clean' state is very small (no data in tables) but then it gets much larger during that one hour then it may be simpler or faster to rely on plain backup/restore.
Also Database Snapshots are only available in Enterprise Edition of SQL Server, so if your demo uses a lower edition (Standard, Web, Express) you must use a backup/restore or an attach/detach and file copy based solution.
Example of a attach/detach file copy based solution:
- You have saved the clean db, its files are
clean_db.mdf
and clean_db_log.ldf
.
- The current dirty db is online, its files are
dirty1_db.mdf
and dirty1_db_log.ldf
- You copy
clean_db.mdf
to dirty2_db.mdf
and clean_db_log.ldf
to dirty2_db_log.ldf
- You detach the database by runing
sp_detach_db
'<dbname>';
- You attach the new files:
sp_attach_db
'<dbname>', 'dirty2_db.mdf', 'dirty2_db_log.ldf';
- You delete the old files
dirty1_db.mdf
and dirty1_db_log.ldf
This procedures reduces the downtime between detach and attach by copying the clean files before the detach/attach operation.