Thursday 2 August 2012

Find and Fix Orphaned Users in SQL Server


Below script will find if any orphan users are exist or not. This will lists the orphaned users: 

EXEC sp_change_users_login 'Report' 

If you already have a login id and password for any user, fix it by using below script. 
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-using below script. 
EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password'

No comments:

Post a Comment