I have a small SQL Server database that I need to copy on command - I need to take the mfd and ldf files at any time, copy them, pin them and make them available to the end user.
Now it is possible manually:
1) Logging on to SQL Server via Remote Desktop
2) Detaching a database through SQL Management Studio. I have to bother with a combination of setting up the database on single_user and / or restarting the service so that I can separate it, since the application server usually writes to it.
3) During detachment, I scan the file system and copy the mdf and ldf files.
4) I reconnect the database through SQL Management Studio
5) I zip up the copied files, and I move them to the FTP server so that the people who need them can receive them.
This is a terrible, inefficient process. This is not just a matter of the need for a circuit, but the need for people to work with snapshots of real production data on their local machines for the purpose of destructive experimentation. Fortunately, the zipped database is very small - maybe 30 megabytes with the log.
Ideally, I would like to create a page in an ASP.NET web application with a button that the user can click to start packing the current database into a zip file, and then I just provided a link to the file.
Pete michaud
source share