How to link user on a loggedship DB

I need to execute the cmd sp_change_users_login

How can I do this with out breaking the log shipping?

Many thanks

If you are on the main instance then the command should not be a problem.

I am on the log shipped instance

If you are on the logged shipped instance I can see no need to change the user login. The DB will be RO so I doubt you can do it anyway.

What I suspect you need to do is copy the login, including it's SID, from the main instance. You can use something like the following to get the CREATE command.

https://support.microsoft.com/en-gb/help/918992/how-to-transfer-logins-and-passwords-between-instances-of-sql-server

ie

  1. Delete the login on the logged shipped instance.
  2. Get the login info from the main instance.
  3. Create the login on the logged shipped instance using the same SID as the main instance.

The user will then point at the correct login SID so you will need to change nothing in your logged shipped DB.

1 Like