Cannot unmap login from db_owner role

  • I'm getting the following error when I attempt to unmap a Windows login from the db_owner role on a database:

    "Drop member failed for DatabaseRole 'db_owner'...Cannot use the special principal 'dbo'"

    The funny thing about this is that when I view the mappings in the "User Mapping" page for this database, under the User column I don't see the particular login, but I see "dbo".

    Any ideas how to fix this? It's driving me crazy...

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • who is the database owner? That login was evidently mapped as dbo.

    The probability of survival is inversely proportional to the angle of arrival.

  • When I right-click on the database, select Properties, in the General page the owner is the SQL service account and not the login I am trying to unmap. (I'm on SQL 2008 SP1).

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • Here is something odd:

    in the said database, under Security/Users, I right-click on the database user "dbo", select "Properties: the User name is "dbo", but the Login name is the login I'm trying to get rid of!

    Login name should be sa.

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • OK, I fixed it, but I don't understand how... :hehe:

    In SSMS I right-clicked on the database, chose Properties, clicked on Files tab, and changed Owner to sa (it was formerly the SQL service account, which BTW is SYSADMIN on the instance).

    I was then able to unmap the user login from the db_owner role on the database with no problems.

    This solution doesn't make any sense, but it worked! Clearly there was some freaky dependency (bug?) tripping this up.

    This link gave me the idea:

    http://stackoverflow.com/questions/162764/sql-server-2005-how-to-change-dbo-login-name

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • did you try "sp_changedbowner newlogin, true" ?

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • ALZDBA (10/14/2010)


    did you try "sp_changedbowner newlogin, true" ?

    This looks equivalent to what I did through SSMS, but I'm still not sure why the service account was not as good as sa for db ownership.

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • - can you repro the situation ? (DDL ?)

    - can you post the actual tsql you tried ?

    (and their results)

    - what's the relation between the service account and the nolonger wanted db_owner member ?

    - is there any db ownership chaining going on ?

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • ALZDBA (10/14/2010)


    - can you repro the situation ? (DDL ?)

    - can you post the actual tsql you tried ?

    (and their results)

    - what's the relation between the service account and the nolonger wanted db_owner member ?

    - is there any db ownership chaining going on ?

    Thank you for these suggestions, I will try to get you some answers.

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply