How to fix SQL Server Orphaned User after Database Restore
A simply way to link back the original user and fix all the permission problem after restoring MSSQL database to a different server using the .bak file.
Step 1:
exec sp_change_users_login ‘Report’
Orphaned users listed in the current database
Step 2:
exec sp_change_users_login ‘AUTO_FIX’, ‘username’
Can automatically log in to add a user name corresponding to the same name in syslogins