EXEC sp_change_users_login 'Report'
GO
EXEC sp_change_users_login 'Auto_Fix', 'user'
GO
EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password'
Wednesday, December 6, 2017
Auto Fix Orphaned User
When restoring a database to a new or different instance, logins at the instance level are not mapped to the database users. SQL SERVER has a built in stored procedure to help us identify orphaned users, sp_change_users_login. We can also use this stored procedure to fix the mapping if the login exists at the instance level. Finally, if we need to create a new login for the existing user, we can create a login and password. See the below examples.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment