Friday, 17 February 2017

How to fix orphaned SQL database users

To find out Orphaned users

EXEC sp_change_users_login 'Report'

If you already have a login id and password for this user then run below command:

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 below command

EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password'

No comments:

Post a Comment

How to find out recent differential backup history in SQL Server

-- Get Backup History for required database SELECT TOP 100 s.database_name, m.physical_device_name, CAST(CAST(s.backup_size / 1000000...