Replication is failing after doing fail over to Secondary replica in Always On

To day i configured Replication on Always on High availability where i have One primary and two secondaries, I configured successfully first time, but i started facing issue after fail over. To overcome those issue we need to run the below commands. 

Before you are running the below commands you have to remotely login into distributor server and run the commands. Dont access distributor server from publiser server and run these. You have REMOTELY LOGIN into the DISTRIBUTOR server.


After fail over what happens is primary server become secondary and secondary server becomes primary, In these cases replication fail with an error message, if it is a Transaction publication and the error message would be "The process could not execute sp_replcmds on NODE1". At this stage NODE1 became a SECONDARY replica and it is throwing error. At this stage we have to run the below commands, the below command will redirect every query to the Availability Group listener regardless of  who is became a primary, if you have more than one secondary replica you need to run the below queries 2 or 4 times , how many secondary replicas you have configured. 






Comments

Popular posts from this blog

System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

Pre login Handshake or Connection Timeout Period

Transparent Data Encryption(TDE) with Master Key and Certificate in SQL Server