Today I’ve encountered a problem trying to drop a user from a database. I kept getting this error:
Msg. 15138 The database principal owns a database role and cannot be dropped
So it looked like the user owned a database schema. To find out the schemas that a user owns I’ve used this query:
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE schema_owner = ‘UserName’
UserName was the owner of the dbo_owner schema, so to return the schema to the original owner I’ve executed this other query:
ALTER AUTHORIZATION ON SCHEMA::db_owner TO dbo
Then I’ve been able to drop the user without problems.