When you restore a database, you can be left in a state where some users are orphaned from the server (even if there is a login with the same name)
Within SQL Server, there is a quick fix.
Step 1 - Run this in the newly restored database and it will show all the orphaned users
EXEC sp_change_users_login 'Report'
Step 2 - Run this and will assign the user to a login name
EXEC sp_change_users_login 'UPDATE_ONE','',''
so for example
EXEC sp_change_users_login 'UPDATE_ONE','testuser','testuser'
And that's it.
No comments:
Post a Comment