You may run into the 15023 error if you restore a MS SQL database from backup. You expect a restored database to be in exactly the same state as the backup, but the login fails for a user that had permissions in the backed up database. When you use the “User Mapping” SQL Management Studio functionality to allow the user permissions to the new database, you receive the 15023 error. This is caused by Security identification numbers (SID) that are mismatched or ‘orphaned’ in the sysusers table.
The SQL Server stored proc sp_change_users_login locates and fixes these records. Run it with a single parameter ‘Report’ to get a listing of abandoned user names and corresponding SIDs:
exec sp_change_users_login Report
The ‘Update_One’ parameter will reconnect a single login:
exec sp_change_users_login Update_One, ‘MyLogin’, ‘MyLogin’
You can find more info about this issue at:
This next blog expands on the available parameters for sp_change_users_login:
Also, try checking out the source for sp_change_users_login found in the Sql Server Management Studio under Databases | System Databases | Master | Programmability | Stored Procedures | sp_change_users_login.
Latest posts by Noel Rice (see all)
- Test Items Hidden ‘Stop on Error’ - July 1, 2015
- What TestComplete Can’t See: Using Accessibility to Find Objects - June 3, 2015
- TestComplete Object Recognition - May 14, 2015
- Sharing TestComplete Object Stores Between Projects - April 28, 2015
- Handling Events in TestComplete Keyword Tests - February 24, 2015