Skip to content

Orphaned Users

If you migrate DB between sql server or if you restore a DB on new sql server, you may get orphaned sql user.
To detect if you’re in this condition, run this sp.
EXEC sp_change_users_login ‘Report’
This will report all login inserted into db and not in sql server.

If you already have a login id and password for this user, fix it by doing:

EXEC sp_change_users_login ‘Auto_Fix’, ‘user’
“Auto Fix” work only with windows users!

If you want to create a new login id and password for this user, fix it by doing:

EXEC sp_change_users_login ‘Auto_Fix’, ‘user’, ‘login’, ‘password’