Sql-server – SQL server Principal and Mirror logins and permissions Issue

loginsmirroringpermissionssql server

In a mirroring setup where server A is my principal and server B is my mirror, I had some issues related to logins and permissions at the time of fail-over.

During fail-over Server B became my principal and Server A my mirror but I was facing login issues on server B and I had to recreate the logins on server B with the same permissions they had on server A.

What is the correct way to handle this scenario? Do I have to create the logins on server B every time I create a login on server A or is there a better way to handle this?

Are there any scripts available to compare and synchronize logins?

Best Answer

I think you will find the Powershell scripts at dbatools quite useful.

Don't forget - there are other server objects that also do not get mirrored. Sql Agent Jobs and Linked Servers to name a couple.