Thursday, September 29, 2011

Fixing Orphaned Users after DB Restore

I restored a database that was backed up from our integration environment, and restored it to my local SQL Server and then my software couldn't log in via SQL Server Authentication.

You see the issue is that the SID was not recognized and needs to be rebuilt. You can find out what you need to use by issuing the following command: 

MSSMS - exec sp_change_users_login











This will list the users that are currently orphaned. So to fix, you just need use the Auto_Fix argument and add the user.

exec sp_change_users_login 'Auto_Fix', 'youUserId'


No comments:

Post a Comment