Tuesday, April 19, 2011

Login invalid for Orphand User

When you try to fix Orphand users in newly restored database the following error will come if the login id is not match with current server



Msg 15291, Level 16, State 1, Procedure sp_change_users_login, Line 137
Terminating this procedure. The Login name 'prd_myUser' is absent or invalid.

Use user_dbname
go


EXEC sp_change_users_login 'REPORT'
go
--prd_myUser -- Orphand users

EXEC sp_change_users_login 'UPDATE_ONE','prd_myUser','prd_myUser'
go


-- error messageMsg 15291, Level 16, State 1, Procedure sp_change_users_login, Line 137


Terminating this procedure. The Login name 'prd_myUser' is absent or invalid.

--Solution
Find the restored database
Expand the Database  Tree
Expand Security
Select  Users to locate 'prd_myUser'  delete it.