SQL Server 2008 R2 error: 15023, user, group, or role already exists

There are a number of things you can try, and the success of each will probably depend on what server role you have.

For starters, if it is just one or two users then honestly, the easiest way is to drop the database user from the restored database, and providing there is an existing server login already, remap the database user to the server login using SSMS. If the server login does not exist then just create it, map the user, and presto! Away we go.

Next option: If you are migrating a large number of users, use sp_help_revlogin. sp_help_revlogin is a Microsoft supplied stored procedure that will help migrate logins from one server to another, including passwords and SIDs. Here is a good article about it SP_HELP_REVLOGIN


I use Auto_Fix with sp_change_users_login in my dev environment to fix such issues (Error 15023). Avoid using Auto_Fix in security-sensitive situations.

Auto_Fix: Links a user entry in the sys.database_principals system catalog view in the current database to a SQL Server login of the same name. If a login with the same name does not exist, one will be created. Examine the result from the Auto_Fix statement to confirm that the correct link is in fact made. Avoid using Auto_Fix in security-sensitive situations.

sp_change_users_login 'AUTO_FIX', 'myuser'

Also, note that this feature may be removed in a future version of Microsoft SQL Server.

Other References:

  1. SQL Server 2008 user, group, or role already exists in the current database
  2. FIX : Error 15023: User already exists in current databas
  3. SQL map a login to an existing user