Fixing Users - Newbie Question

  • Hi all

    I just restore a db from live to test and need to fix users.

    I have run the command below to get a list of the orphaned users:-

    use dbContentsSTM

    go

    EXEC sp_change_users_login 'Report'

    go

    And then am running the EXEC sp_change_users_login 'Auto_Fix', 'user' statements one at a time... so how can I speed this up? How can I run this script so that is fixes all orphaned users?

    Thanks

    Farren

  • You can develop the script for the same.

    or

    Search on the web(google) you will find one. 😛

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • I always script the user from the Prod environment and run that script on the test or dev environment to copy the users then I never have to mess with trying to fix users when a DB comes over.

    There are scripts to do this also, I think on SSC.

    Chris

    Learning something new on every visit to SSC. Hoping to pass it on to someone else.

  • Get two sp (dbo.sp_help_revlogin, dbo.sp_hexadecimal)

    from microsoft web site and create it on your live server's master database. run sp_help_revlogin to generate logins script.

    Take the generated script and run on TEST server (to create logins), with this you do not need to sync logings and users. But you need to perfrom this step for any new logins you create on production server.

  • Thanks for your help people, I think that gives me all the info I need.

    Cheers

    Farren

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

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