login mapped to user dbo

  • Hi

    I have a problem with rights after restoring a database from a backup. The backup have removed all the rights in the database. I have then removed all users in the database and mapped the login to the new users and assign their rights.

    I have one login that has been mapped to the dbo user in the database and I cannot alter the dbo user to not have a login and if I delete the login and create it again the I get an error saying that a user already exits.

    Does anybody know how to solve this problem?

    Kind regards

    Bo

  • I found a way

    Change the dbo users login to SA with this command

    exec sp_changedbowner 'sa', true

    and then mapped the login to a new user in the database.

    Regards

    Bo

  • sp_change_users_login @Action='update_one',

    @UserNamePattern='username',

    @LoginName='dbo'

    GO

    provide name of your user in 'username' and then try to map the user by running above command.

    DBDigger Microsoft Data Platform Consultancy.

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

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