Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When MSSQL DB Mirroring fails over, our script won't login, fails on:

Cannot open database requested by the login. The login failed. Login failed for user ...

The way I can fix this is by running:

EXEC sp_change_users_login 'Auto_Fix', 'MyUsername', NULL, 'MyPassword'

How can I sort this so logins just work automatically?

share|improve this question
up vote 1 down vote accepted

Found out we need to recreate the logins on the mirror server with the same SID.

share|improve this answer
Just to add, this works. – Marcus Apr 9 '11 at 15:34

Another solution could be to rely on domain accounts, where the SIDs are managed by the domain, rather than sql server accounts, where the default SIDs are instance-specific.

share|improve this answer

Robert Davis is the author of the only DBM book and is a MCM. Try the below if it helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.