AG Failover vs connections

Carl Bruneau 136 Reputation points
2023-04-05T20:12:49.93+00:00

Hi all, If an automatic failover occur on an AG, will the connections of the applications be disconnected from the cluster or will this failover be totally transparent to the applications using it? Best regards. Carl

SQL Server | Other
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 121.9K Reputation points MVP Volunteer Moderator
    2023-04-05T21:53:54.7+00:00

    The applications will typically experience an error. A running query will fail, and if the application tries to reuse a connection from the connection pool that will also fail in many cases. But applications can be written to be resilient to such things. That is, they can capture such errors and retry.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. ZoeHui-MSFT 41,491 Reputation points
    2023-04-06T03:19:52.8+00:00

    Hi @Carl Bruneau,

    When an availability group failover occurs, existing persistent connections to the availability group are terminated and the client must establish a new connection in order to continue working with the same primary database or read-only secondary database. While a failover is occurring on the server side, connectivity to the availability group may fail, forcing the client application to retry connecting until the primary is brought fully back online.

    Check it out here: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b8857583-0ad7-419c-904b-e9e2a13511c0/sql-connections-to-the-sql-2012-always-on-availability-group?forum=sqldisasterrecovery

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.