Fixing Orphan User on SQL Server Snapshot Mirror

loginsmirroringSecuritysql serversql-server-2012

I am sort of confused about orphaned users in database snapshots created on the partner server participating in database mirroring.

Server A acts as principal for database X, with server B as its mirror, having database snapshot configured for that database X for reporting purposes.

We recently had a failover. After that I fixed the orphaned users in database X on server A.

However, when I view the same for the database Snapshot on server B, they are not listed.

If i manually try to fix orphans on X-snapshot on server B, it throws the error

Failed to update database "X-snapshot" because the database is
read-only

The snapshot job runs every 30 mins.

Please clarify or suggest how to fix the orphaned users in the snapshot

Best Answer

You can transfer the logins that are associated with orphaned users from server A to server B using the method explained in this KB article.

How to transfer logins and passwords between instances of SQL Server

Or you can use Copy-DbaLogin PowerShell command to do it.

Copy-DbaLogin