Sql-server – Drop permission from a dbowner

permissionssql server

How can we remove the drop permission from a user or a role like dbowner? Want to restrict the dbowner from dropping the database.

Best Answer

Even if you meant Sql Server and just mis-spelled db_owner, the answer holds true for any database: use the principle of least priviledge. That is, if an user shouldn't be able to drop the database, do not assign such privileges in the first hand at all.

Messing with built-in security group and role settings is bad practice, unless you are very sure what you are up to. Create new roles with appropriate settings instead. This way, you or any other DBA doesn't have to double-check if default permissions are really on default settings.

That being said, you might be able to prevent drops with some creative triggers. As how to do that, depends on your RDBMS.