User 'dbo' mapped to two different logins

  • I have a weird one here. In the master database the user 'dbo' is mapped to the 'sa' login. In my user database (userdb) the user 'dbo' is mapped to another login (I'll call the login 'beth'). How did this happen? When I look at the logins (under EM Security) 'sa' and 'domain\beth' are there. When I look at the users in the master database 'dbo' is mapped to 'sa' and 'beth' is mapped to 'domain\beth'. When I look at the users in the userdb 'dbo' is mapped to 'domain\beth'.

    The system files contain:

    master.dbo.syslogins has name = sa and sid = 0x01.

    master.dbo.syslogins has name = domain\beth and sid = 123456.

    master.dbo.sysusers has name = dbo and sid = 0x01.

    master.dbo.sysusers has name = beth and sid = 123456.

    userdb.dbo.sysusers has name = dbo and sid = 123456.

    userdb.dbo.sysusers has no entry for name 'beth' but when I attempt to add it I get Error 21008: [SQL-DMO] Login 'beth' already exists.

    How do I fix this?

  • Each database has its own database owner.

    If you want to change it read up on the stored procedure sp_changedbowner in books on line which will change the database owner and dbo alias.

    ie. exec sp_changedbowner 'sa'

    Steven

  • Take a look at sp_addalias too. Aliases are normally used so that you can allow a user to create objects owned by dbo without making them the db owner. You confirm is this is what happend by seeing if the column IsAliased is set to 1 in sysusers.

    Andy

    http://qa.sqlservercentral.com/columnists/awarren/

Viewing 3 posts - 1 through 2 (of 2 total)

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