sql2000 new login user error: The reason "21002 [SQL-DMO] *** user already exists" and solutions [...] solutions orphaned users

Error symptoms:   

      [SQL-DMO] *** user already exists: After SQL Server200 with additional data into the database, 21002 error occurs when logging in the New. And then found not completed the user has logged on the list. Delete reconstruction, the problem remains the same.

 

Reason:
        This is what we usually call "
orphaned users ", the so-called orphaned account, the account is a database of user names and not only the login name, such users exist in the sysusers system table in a user's library, and in the master database but not in syslogins the corresponding record.

Orphaned accounts are generally caused due to the following two conditions:
1. The database will restore the backup on another machine;
2. After reinstalling the system or SQL SERVER only restore the user library


Solution:
Method One:
SQL Server2000 Enterprise Manager - > database -> expand the problem of database -> users -> select the problem in the right window user name -> right click -> delete.
Then in the Enterprise Manager - select a user name the problem in the right window> - -> Security -> Login> right click Properties -> Database Database access point to the selected // *** -> ditch option below * ** public and db_owner database role to complete!

Method Two:
The solution is to use sp_change_users_login to repair. sp_change_users_login usage has three steps:
Step. 1:
Exec sp_change_users_login 'the REPORT'
lists orphaned user's current database
Step 2:
Exec sp_change_users_login 'Auto_Fix', 'username'
can automatically user
name corresponding to the same name login to the syslogins
Step 3:
exec sp_change_users_login 'uPDATE_ONE', 'user name', 'login'
user name mapping for the specified login name

Reproduced in: https: //www.cnblogs.com/Codenewbie/p/3330372.html

Guess you like

Origin blog.csdn.net/weixin_33770878/article/details/93448115