Preventing Accidental Restores

  • Hi all,

    Is it possible to prevent a database from being restored over by the restore command? Obviously something that is reversible so that it can be restored over if necessary, but you have to perform some function first to prevent an accidental restore from a previous state.

    Thanks

    Rolf

  • Anyone who has the capacity to overwrite the database in a restore from a security stand point is going to be able to undo your changes. DDL triggers don't have RESTORE in scope. I think the only way to do this for sure is to revoke privileges so that people can't run the restore operation.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks...it was really to stop people who can and should be restoring databases from making a silly mistake..ie introducing some fences and hoops to make sure they really do want to overwrite a database =)

  • For production, first thing, everyone has a second login from their standard one. One that's for your machine, email, development, whatever. Another that's only for production. A lot fewer errors if you can't even get there. Next, no one is allowed to use ROLLBACK IMMEDIATE in their scripts. That alone usually stops oopsie in prod. Next, there are several third party tools, but SQL Prompt is the best (I work for Redgate), that will let you color code the tabs in SSMS. Make sure production is something ugly & loud.

    I think that's all I can think of at the moment that could help a little.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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