Pages

Mar 16, 2018

SQL Server: Error while alter the schema owner to dbo



While deleting one of the orphan below exception happened. 

Msg 15138, Level 16, State 1, Line 6
The database principal owns a schema in the database, and cannot be dropped.

Then I tried alter the schema to dbo and got below error. I didn't see the schema physically under Schema tab in Security of this database but this orphan is assigned as owner of database schema. 

Msg 15151, Level 16, State 1, Line 4
Cannot find the schema 'domain\login', because it does not exist or you do not have permission.


When I right click this user I see below mapping!


Now I was playing here and there and finally right click the schema to check what I am searching and found this orphan user as owner of those schema. 


Changed it to dbo and then I am able to delete this orphan user. 


No comments: