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

Hi!
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: http://www.sqlservercentral.com/scr…rynm=Maintenance and Management &categoryid=1 Luis Martin
Moderator
SQL-Server-Performance.com 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:
http://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=4529 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
WHERE DBID > 4
Order By Name This will gerneate the needed code to update all logins on all databases like this:
–Result
Use UserDBName1
exec sp_fixusers
GO Use UserDBName2
exec sp_fixusers
GO
… Argyle… post this on the tips section.. if you could. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
]]>