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!
LVL 2
Starr DuskkASP.NET VB.NET DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brad GrouxSenior Manager (Wintel Engineering)Commented:
Utilize scheduled tasks to kick off the process - http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614(v=vs.85).aspx
0
AndyAinscowFreelance programmer / ConsultantCommented:
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.
0
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
Sounds great. Now how do I do that?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
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!
0
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
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!
0
AndyAinscowFreelance programmer / ConsultantCommented:
>>Job with schedule - will it run when db in use?

I have not tried to do what you are asking, this is an untested idea.

My understanding of how .net handles databases would be - probably yes apart from occasional times when no it wouldn't.  (Does that help you at all?)

Again I believe that .net would load the data then disconnect.  To update you run code to put data back from the UI by re-opening the connection, performing the update then closing the connection again.  So without any active connection your job would run without problems.  With a read then it may well run properly.  With a write I would anticipate problems.  BUT irrespective of this the UI would not be refreshed until you run code from the front end to do it.  
Hence my idea.  Read the db into dataset/datatables for the UI - just as you would normally.  Repeat this every 30 minutes and refresh the UI.  Just don't write any code to write changes from the UI into the db.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Anthony PerkinsCommented:
Will it run if the database is in use? How would that work?
No it would not.  You would have to close all connections first.
0
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.