SQL Server – Ask for Password Before Dropping Specific Database

passwordsql server

I've got 2 databases which are very important for our organization. I would like to prevent an accidental drop/delete of them… Do you have any suggestion? I was thinking about asking a password before perform the drop. Is this possible in MS SQL Server?

Best Answer

You are operating in a very risky security environment by sharing a single user with all permissions. The quickest solution is to revoke DB_Owner on the shared account for each database but leave reader/writer/ddladmin/backupoperator/accessadmin. That will prevent the shared User from dropping any databases they are attached to but should still have control over all the innards of those particular databases. If you need a User aside from your System Admin accounts that can drop databases you can create it separately and only use it when necessary.