DBAtlas · Database operations atlas

15138: The database principal owns a schema in the database, and cannot be dropped

SQL Server

What does it mean?

An attempt was made to drop a database user/role (database principal), but it could not be dropped because the principal owns one or more schemas in the database. It cannot be dropped until the schemas it owns are transferred to another principal.

Why does it happen?

The user being removed is the OWNER of at least one schema (e.g., a schema created with its own name by default, or one assigned via AUTHORIZATION). SQL Server blocks the drop to avoid leaving orphaned schemas.

How to fix it

Find the schemas owned by the user: SELECT name FROM sys.schemas WHERE principal_id = USER_ID('app_user'); Transfer ownership of these schemas to another principal (e.g., dbo): ALTER AUTHORIZATION ON SCHEMA::[app_schema] TO dbo; If the schema is no longer needed (and is empty), DROP SCHEMA. After ownership has been transferred, run DROP USER again.

Open in DBAtlas →

More from this engine