Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 373201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:17:07+00:00 2026-05-12T14:17:07+00:00

I run a software platform and am thinking of setting up a demo site

  • 0

I run a software platform and am thinking of setting up a demo site so that people can login into a pretend site and edit the data, etc…

However I want then the database to ‘reset’ every ‘x hours / days’ is there a way sql server can do this itself? Otherwise I will have to code an application to restore all the table data and that will take a lot of work.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:17:07+00:00Added an answer on May 12, 2026 at 2:17 pm

    Yes, you create a database snapshot of the ‘clean’ state then every hour you revert the ‘dirty’ database from the clean snapshot. See:

    • How to: Create a Database Snapshot (Transact-SQL)
    • How to: Revert a Database to a Database Snapshot (Transact-SQL)

    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:

    1. You have saved the clean db, its files are clean_db.mdf and clean_db_log.ldf.
    2. The current dirty db is online, its files are dirty1_db.mdf and dirty1_db_log.ldf
    3. You copy clean_db.mdf to dirty2_db.mdf and clean_db_log.ldf to dirty2_db_log.ldf
    4. You detach the database by runing sp_detach_db '<dbname>';
    5. You attach the new files: sp_attach_db '<dbname>', 'dirty2_db.mdf', 'dirty2_db_log.ldf';
    6. 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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a client software that will run on a Unix system
If a particular piece of software is made to be run on one platform
Is there any API or tool that can automate software updating? It should take
We have a piece of software which can run on several different graphics cards,
I see that there are Open Source Java-written software that run from an executable.
I am developing a embedded software that is meant to run on two to
I'm thinking about exploring the idea of having our client software run as a
Is there any difference in behavior of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run registry key, when an user Logs
We are working on an update system for our software. The updater should run
I run into this problem. I have a textarea which I only want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.