Typically, when a database is restored, a login name is added to the database.
For example, the database backup file already contains the user ABC, now restore the database, and then found that the existing database does not have the ABC user, want to create a new ABC user, as the owner of the database, this problem occurs.
http://blog.csdn.net/cjh200102/article/details/8669166 This article for a detailed introduction.
It can be understood that logins and users are two different concepts, although the names are the same. When you create a new login, you do not get an error if you do not add the database map.
Adding a database map is equivalent to adding a user with the same name to the database. However, there is already a user of ABC, so this will be an error.
You can resolve the problem by using the following methods.
1. Create a new ABC login name, but do not add a database mapping.
2. Use the script to associate the orphaned user ABC to the LOGIN ABC:
Use [Database name]gosp_change_users_login ' Update_One ', ' abc ', ' ABC '
Workaround for database new user prompting "user, group or role ' XXX ' already exists in current database"