Script to map logins and users of all db on server | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Script to map logins and users of all db on server

Can You suggest me any script which will function as sp_change_users_login for all the dbs on the server at a time as well as map the sid of login and user.This I need to make the current server exactly like old server.I dont want to leave any stones unturned
Check:…rynm=Maintenance and Management &categoryid=1 Luis Martin
Moderator One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important
Bertrand Russell
All postings are provided “AS IS” with no warranties for accuracy.
Think I answered this already in another post. In the following post you will find the needed scripts: there is a script called sp_fixusers. Create that SP in the master database then run: –Sync logins in All Databases – custom SP
SELECT ‘Use ‘ + Name + ‘
exec sp_fixusers
G’ + ‘O ‘
FROM master.dbo.sysdatabases
Order By Name This will gerneate the needed code to update all logins on all databases like this:
Use UserDBName1
exec sp_fixusers
GO Use UserDBName2
exec sp_fixusers
… Argyle… post this on the tips section.. if you could. Satya SKJ
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.