Fixing of logins across domains

  • Hi,

    If am trying to transfer sql logins or across domains am restoring the backups. How would i map the SID's?

    How to resolve the problem?

    Can anybody explain how sql server internal does the fixing/mapping of Logins??

  • [font="Verdana"]****Please change name of the database before executing the script*****

    Use 'Database Name'

    go

    SELECT

    'EXEC sp_change_users_login ''Update_One'', ''' + su.name + ''', ''' + su.name + ''''

    FROM

    sysusers su

    LEFT JOIN master.dbo.syslogins sl ON su.sid = sl.sid

    WHERE

    uid > 3

    -- exclude public, dbo, guest, INFORMATION_SCHEMA

    AND uid <> gid-- exclude groups

    AND uid < 16384-- exclude database roles

    AND sl.sid IS NULL-- user not linked to a login

    ORDER BY su.name

    Execute Output of this script in another or same window and it should do the job for you.

    Njoi SQL'ing[/font]

    ~RD

  • This has to be executed on the source sql server and take the output and execcute it on the target sql server. Right??

    Correct me if am wrong!!!

    Thanks.

  • No, that happens on the destination server later. First read this: http://support.microsoft.com/kb/918992 about how to script out the logins and passwords on the source server and run the scripts on the destination. Once you've got the logins transferred, check out BOL for sp_change_users_login.

  • Thanks a lot!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply