Document: Very short note on reviving SQL accounts, after moving or restore of a Database on another machine. file : revivesqlaccounts.txt Version : 0.1 Date : 15/02/2012 By : Albert van der Sel Antapex.org ---------------------------------------------------------------------------------------- If you move, or restore a Database from one SQL Server on machine A, to another SQL Server installation on machine B, the SQL database accounts are not "in sync" with the SQL logins (on B) anymore. Here we will touch on two methods to sync or recreate SQL accounts. Note: here we solely deal with SQL accounts, and not "Windows logins" like AD accounts and groups. 1. Suppose the SQL Logins on machine B exist: ============================================= Use the "sp_change_users_login" stored procedure. You can use the "sp_change_users_login" stored procedure, to sync the user's database security id, with the login's security id. Suppose "harry" is a SQL login on machine A and B. If you restore database X from machine/instance A to machine/instance B, then on B you can try the following TSQL command: (on machine/instance B) USE X GO exec sp_change_users_login 'Update_One', 'harry', 'harry' GO 2. Suppose the SQL Logins on machine B do not exist: ==================================================== Use the "sp_help_revlogin" stored procedure. On machine/instance A, use the "sp_help_revlogin", to script the create command of that SQL login, including the hashed password. If you run that script on machine/instance B, the user will be created with the same password. (on machine/instance A) exec sp_help_revlogin 'harry' This will produce the create login script, including the true password of that user. Notes: If the procedure is not present on your system, you need to create it. It's very easy to do that. check the following pages, for more information: http://support.microsoft.com/kb/246133 The above url will tell you also much more on methods about transferring logins between different environments.