Script for Copying Logins from one server to other server with database

  • Hi,

    I want to copy a set of windows Logins & Database Logins from one server to other sever with same roles setup & Passwords.

    Please guide me how to do this.

    Cheers,

    Anil

  • Take a look at http://support.microsoft.com/kb/918992. This works in 2008 as well as 2005.



    Shamless self promotion - read my blog http://sirsql.net

  • I've used this script, which is a modified version of sp_help_revlogin, to script out logins, server roles, database users, database roles, and object permissions. Remember that the databases need to exist in the destination server before you can create users. Considering that, you might as well backup and restore the databases, which would also move the database users and their permissions.

    http://www.sqlservercentral.com/scripts/31776/

    Greg

  • Hi All,

    Thanks for the reply. If we Back up & restore the database in another server whether all security Objects like Users,

    Roles etc will also move to new server.

    Suppose if some of the users alreday exists on new server is there any way to skip that users.

    Please let me know on this.

    Cheers,

    Anil

  • Hi All,

    Sorry, One more question if the User IDs already exists in the server I need replace the User IDs during Copy of logins.

    Please let me know is this possible?

    Cheers,

    Anil

  • Anil Kumar Kurra (4/23/2009)


    Hi All,

    Thanks for the reply. If we Back up & restore the database in another server whether all security Objects like Users,

    Roles etc will also move to new server.

    Suppose if some of the users alreday exists on new server is there any way to skip that users.

    Please let me know on this.

    The difference between a login and an user - a login allows a person to connect to SQL Server; a user allows a person to access objects in a database.

    So users only exist in databases. If you restore a database users, roles, and schemas are also restored. After copying logins and databases to a new server, you may need to re-sync the users with their logins. See sp_change_users_login in BooksOnLine.

    Greg

  • Hi SSCarpal Tunnel,

    And thanks for providing excellent script and saving be lot of headaches.

    Cheers.

Viewing 7 posts - 1 through 6 (of 6 total)

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