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)
- Websites Behaving Badly - December 12, 2014
- Will Your Web App Fail Under Stress? - December 12, 2014
- Dependent Methods (calculated fields) – a hidden goody in Kendo UI - May 10, 2014
- Lookup Columns in Kendo Grid - April 13, 2014
- Aggregates with Kendo DataSource - April 6, 2014