Logins

  • Hi,

    Iam doing backups of 2 databases from server1,copy the backups to server2 and restore in server2.

    Now I need to give db_reader permissions for the 2 databases coming from server1 to the logins Scott, smith which are already exist in server2 and these users are not there in server1.

    So my task is add a script to give db_reader to the the above logins once the databases are restored in server 2

    Could you plz help me with script to give db_reader permission to those 2 logins for that particular 2 databases?

  • USE dbname

    CREATE USER Scott

    FROM LOGIN Scott

    SP_ADDROLEMEMBER 'db_datareader', 'Scott'

    Do the same thing for smith.

    Greg

  • use the sp_help_revlogin 'scott'

    so you get the same sid

    otherwise

    every time you restore a database you will have to run the

    sp_change_users_login 'report'

    or sp_change_users_login 'auto_fix','scott'

Viewing 3 posts - 1 through 2 (of 2 total)

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