We're just starting to use database mirroring at a client. Obviously we need to copy over logins, role memberships, jobs, etc. to the target machine on a regular basis. I looked at the SSIS task to do this and wasn't very impressed.
How are people doing this?
Either with an SSIS task, or setup a policy so that when an admin creates a login on one instance, that same login is created on the mirror instance as well.
You could also look into writing an T/SQL script which collects all the logins and then creates them on the remote system nightly by hacking up sp_help_revlogin and using that.
answered Oct 12, 2009 at 09:08 PM
I use a script and linked server to do this, running from a daily Agent job. This synchs up the password for SQL accounts and keeps the SID the same, similar to sp_help_revlogin.
answered Oct 13, 2009 at 12:53 PM
You will also need to ensure that the database users are mapped correctly to the logins on the server. Using this script when the mirror and principal swap roles should do it
declare @users table ( username sysname, usersid varbinary(85) )
declare @username sysname
insert into @users exec sp_change_users_login 'report'
declare user_cursor cursor for select username from @users
fetch next from user_cursor into @username
while (@@fetch_status = 0) begin exec sp_change_users_login 'auto_fix', @username fetch next from user_cursor into @username end
answered Oct 13, 2009 at 12:50 PM