Thursday 17 January 2013

Sql Server Script AutoFix Orphaned Users




A common task I'm asked to perform by developers\testers is the copying of production databases to dev or test environments.
The backup and restoring in batches of databases can have the affect of creating the orphaned users, where the database accounts become misaligned with the Sql Server accounts.

The general resolve is to use the sp_change_users_login proc. The issue arises when there are multiples of accounts to fix  along with several databases. This can be a time consuming process to do this manually for each account.

The following script I wrote helps reduce the time involved in fixing the orphaned accounts.

No comments:

Post a Comment