SQL

Orphaned SQL Users

When you restore a Microsoft SQL Server database to a different Server you will get Orphaned SQL Users.

First, we need to find the orphan users. This will lists the orphaned users:

 
EXEC sp_change_users_login 'Report' 

If you already have a user on the new server that corresponds to the database user, you can fix it by doing:

 
EXEC sp_change_users_login 'Auto_Fix', 'user' 

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' 

Leave a Reply

Your email address will not be published. Required fields are marked *