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)
- Using HoloLens Toolkit to Deploy Your App - October 12, 2016
- Using HoloLens Toolkit to Configure Your App - October 7, 2016
- Get Started with HoloLens Toolkit in Unity - October 5, 2016
- Using TestComplete Objects in TypeScript Classes - June 8, 2016
- Creating a TestComplete JScript Framework with TypeScript - June 7, 2016