Automated restore of SQL database on request?

  • Hi,

    I am currently running SQL server in a demo environment and during the course of the demo the database is edited and changed. I am trying to find a way to create a simple script/ job that an end user can click and it will automatically restore the original database on request, to save them having to go into enterprise manager.

    Does anyone have any ideas of the easiest way to do this. Does this need to be done using SQL-DMO? Any advice will be much appreciated.

    Thanks in advance.

  • It's pretty simple to script a restore from backup -- in my firm we do that for training and development copies of our production database. You could write the restore script, then maybe create a batch file that will execute the script using osql /i.

  • DMO could do it, but you have a rights issue. What I'd do is create a good process the sysadmin can use. Then setup a job to restore the db and email someone. Now setup a 2nd job that scans a table, looking for the name of a db, time, and user email. If it finds one, run the 2nd job and send the email to the user.

    Might cause delays of a few minutes for things to start, but it will work. You do need some way for the user to click a button and get the entry in the table.

  • As stated above, create a backup script, place it in a file, create a batch file that calls osql. In order to allow users to run this script without worrying about permissions, set up a Windows Scheduled Job on the server you are restoring the database on to call that batch script you created. Insert a username and password that has access to restore a database.

    When a user wants to restore the database, have them simply go to \\SERVERNAME. Click Scheduled Job and run the job.

    Good Luck

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply