Change DB Owner

  • I am trying to change the owner of a database and I am getting this error :

    sp_changedbowner 'sa'

    Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 46

    The proposed new database owner is already a user in the database.

    If I try to drop 'sa' as a user, I get this:

    sp_dropuser 'dbo'

    Server: Msg 15181, Level 16, State 1, Procedure sp_revokedbaccess, Line 43

    Cannot drop the database owner.

    Any idea how do I change the owner of the database ?

    Thanks.

  • I actually meant :

    sp_dropuser 'sa'

    Server: Msg 15008, Level 16, State 1, Procedure sp_dropuser, Line 12

    User 'sa' does not exist in the current database.

    Thanks.

  • sa might be mapped to a user. The login would be sa, the user something else.

    select

    u.name

    , s.name

    from sysusers u

    inner join master.dbo.syslogins s

    on u.sid = s.sid

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

    http://www.dkranch.net

  • 'SA' is mapped to 'DBO' ( as I can see in the user list ).

    But when I right click on that database -> properties -> it shows the database owner as some other ID.

    I dont know what is going wrong.

    Thanks.

  • Try run sp_changedbowner 'anyotherloginhere' and then sp_changedbowner 'sa'.

  • Great!! That worked.

    Any idea what was the confusion over here ?

    why in EM I was seeing a different ID as a DBO while 'sa' was the actuall DBO ?

    Anyways thanks for your help.

  • If you change db_owner, EM needs a full refresh (i.e. disconnect/connect) to get the correct info. EM is nice, but it has some leaps.

    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

  • it worked for me, Thanks

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

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