possible? scripted DB drop/restore from backup, restart

G

Guest

I'd like to make a tool that non-technicians could invoke if there was a
defacement or destruction of our database data for whatever reason and an
expert wasn't around to tend to things. The sequence would run something
like this:

1) Take IIS offline if necessary and drop existing DB connections
2) Back up current database to [timestamp]_[dbname]_dropped.bak
3) Restore from a known good backup
4) put IIS online if necessary

I'd imagine this can be done via script. Items 1) and 4) are the biggest
mystery. From my experiences working with the SQL Server GUI, existing
connections must be closed to the DB before backup/restore ops, and the only
reliable way I've found to do this is to stop IIS. Perhaps there is a way to
force things entirely in script. Script would be preferable if it is a
reliable way to accomplish what I'm trying to do.

Can someone suggest approaches and ideally a resource or two to read
through?

Thanks.
-KF
 
S

Steven Cheng[MSFT]

Hello KF,

From your description, I understand that you're trying to author some
script or a program to programmaticlly turn off ASP.NET application in IIS
server and perform database backup task in SQL Server, correct?

I'm wondering whether your database will be used by the ASP.NET application
only or if you only care about the data accessing from ASP.NET web
application? If you only care about the data accessing from ASP.NET
application, you can consider the following means:

1. stop and start IIS service as you mentioned

2. If you're using IIS6, you can also stop the application pool if the
ASP.NET application only.

here are some IIS management related script resources:

http://www.microsoft.com/technet/technetmag/issues/2005/11/InsideMSCOM/defau
lt.aspx

http://technet2.microsoft.com/WindowsServer/en/library/bb299087-c6c3-4748-a4
6a-43710abceddb1033.mspx?mfr=true

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/0
03ed2fe-6339-4919-b577-6aa965994a9b.mspx?mfr=true

http://blog.crowe.co.nz/archive/2006/07/11/669.aspx

3. For ASP.NET 2.0, there is a new feature. You can put a "App_Offline.htm"
file in the certain ASP.NET 2.0 application's main directory. Then, any
sequential requests won't be processed(deny by ASP.NET applcation runtime).
You can use this feature to stop the ASP.NET application's processing.

http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thanks Steven. This is exactly the "friendly manual" stuff I needed to get
going with the job. Appreciate the resources.
-KF
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top