User Group or Role already exists in the current database

User, Group, or Role already exists in the current database. (Microsoft SQL Server, Error: 15023)

While after restoring the database I just created the users in the new server and then trying to map to the restored databases …. I got an error like User, Group, or Role already exists in the current database… 🙁

This error 15023 occurs in current database when a database is restored from another sql instance
The databse user is not mapped to the corresponding login at the instance where it is restored and termed as orphaned user.

So when I tried to login to the restored database with an orphan user it gives error as “login failed for ‘user1”.


To resolve this issue . Execute the following stored procedure to bind the user mappings from the old server to the new server.


Now you can check in user Login Properties and you will see that old user mappings are restored in your new SQL Server.

You will get following output if it’s successful


This error was found in sql server 2012 express and above is the solution for it. Please comment if you find the post useful.

Add a Comment

Your email address will not be published. Required fields are marked *