Thursday, July 12, 2012

login already has an account under a different user name. (Error: 15063)

We have migrated few databases from old server to server server, later the application is failing to login at one particular database. I verified the database security and confirmed that user is missing then i started adding the user into that database and i encountered the below error

The login already has an account under a different user name. (Microsoft SQL Server, Error: 15063)

There is a login called app_user, I tried  to add that user like below
Databases -- Security -- New User -- Name - app_user and Login name = app_user but it is giving the above error. It is because the dbo is mapped with app_user for that reason it is not allowing us to map the new user with same login.

To resolve this
Run the below command on the problematic database
Use database_name
sp_changedbowner 'sa'

After executing the above coammdn then it will allow you to add a new user then we can map the user with specified to login. We can't directly do this from wizard, we need to run the T-sql command to modify it. And also it doesn't allow to drop the dbo user from the database.





2 comments:

  1. Thank you. That worked great!

    ReplyDelete
  2. Excelente, funcionou!! Muito Obrigado!

    ReplyDelete