Link to home
Start Free TrialLog in
Avatar of Starr Duskk
Starr DuskkFlag for United States of America

asked on

Creating demo site with database that refreshes every 30 minutes

My client wants me to create a demo site with a demo database that updates every 30 minutes; allowing users to just get in, mess with the data and then auto-reset.

What would I need to do on the server to have it automatically refresh every 30 minutes?

I'm thinking I would create my sample database. Create a backup of it.
Then create a Job that would Restore the backup and run that job every 30 minutes.

Something like this? Will it run if the database is in use? How would that work?
Is there a better way?
RESTORE DATABASE [DEMODBF] FROM  
DISK = N'C:\DBFBackups\DEMODBF_Hourly.bak' 
WITH  FILE = 1,  MOVE N' DEMODBF ' 
TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\DEMODBF.mdf', 
 MOVE N' DEMODBF_log' 
 TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\DEMODBF.ldf', 
  NOUNLOAD,  STATS = 10

Open in new window


Thanks!
Avatar of Brad Groux
Brad Groux
Flag of United States of America image

Utilize scheduled tasks to kick off the process - http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614(v=vs.85).aspx
Avatar of AndyAinscow
You could always implement everything apart from the actual update.  Dot net uses disconnected data as the default method anyway.  Then every 30 minutes just trash the in memory data set (user side) and reload it anew.
Avatar of Starr Duskk

ASKER

Sounds great. Now how do I do that?
Brad,

I had said:
>>Then create a Job that would Restore the backup and run that job every 30 minutes.

Thanks for the link, but yes, I already know how to create a job and schedule the job. That is built into the job options under Schedule.

thanks!
I guess I can just test this theory, but wanted to know if anyone knew. Back to my original question, if I create a JOB with a schedule:

>>Will it run if the database is in use?

thanks!
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks!