Can anyone share your inputs on below and how to fix the issue and possible causes of failure?

I am trying to restore a DB using PS script and at one step it is failing during the role change test and during failover.

All Databases are Synchronized and BCP is Synchronizing and alwayson AG is in green and Healthy.

But I am still facing the below issue.

enter image description here

Verified the SQL Server logs and can see below point:

A connection timeout has occurred while attempting to establish a connection to availability replica '' with id [xxxxxxxx]. Either a networking or firewall issue exists, or the endpoint address provided for the replica is not the database mirroring endpoint of the host server instance.

  • When you restore the database, are you adding it to the Availability Group before attempting failover? If so, are you also restoring the DB on the secondary replicas and joining it to the AG on them as well? – HandyD Sep 13 '18 at 4:09
  • Yes @HandyD , that is right . Mine is a 3 Replica AG . 2 Synchronized and BCP Synchronizing. – DBOn Sep 13 '18 at 5:29
  • When you are testing failover, are you failing over to a synchronous or asynchronous replica? – HandyD Sep 14 '18 at 8:18
  • Based on your error the path does not look correct: SQLSERVER:\SQL\$SecondaryReplica$SecDefault` Is that correct? If this is a named instance or default that path is done as SQLSERVER:\SQL\$SecondarReplica\$InstanceName` (named instance) or SQLSERVER:\SQL\$SecondarReplica\DEFAULT\... (default instance). – user507 Oct 11 '18 at 19:56
  • Thank you Shawn and HandyD , I figured out the issue. Issue is with Sleep time in the code . It is set for 10 seconds , during this time the failover is not able to 100% complete . After increasing the sleep time to 40 it got processed successfully. Thanks for your time . – DBOn Oct 12 '18 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.