Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am in the process of setting up always on high availability clusters for the first time. Can anyone explain to me from the networking perspective after configuring the group and testing to make sure it is functioning properly, how does SQL know when to fail over, and how would my application connecting to the SQL server know where it is pointing?

So for example I have an application foo connecting to a named instance DB01.FOO. When foo fails and is rolled over to DB02.FOO, how would my application know it should be talking to DB02.FOO?

DB02.FOO is in the same domain but a different server. I am just trying to wrap my head around all aspects of this before attempting it. If there are any links someone would recommend that would be awesome as well.

share|improve this question

migrated from Jul 5 '12 at 15:20

This question came from our site for professional and enthusiast programmers.

up vote 11 down vote accepted

how does SQL know when to fail over

There is a Flexible Failover Policy which you can use to adjust the sensitivity to the criteria that will trigger a failover. The default is FAILURE_CONDITION_LEVEL = 3 which means "critical error, server unresponsive, or server down." You can see more details here and here.

how would my application ... know where it is pointing

If your availability group listener is properly configured, the connection string should not need any further knowledge to always connect (even if after a retry) to the primary replica on a specific server - it does not need to know those implementation details at all. All it needs to do is point at the listener, and the listener determines if the primary replica is currently on DB01 or DB02. This is pretty powerful since it lets you adjust your AG configuration and move replicas all over the place without ever having to touch the applications (except in cases where you (a) add a replica with read-only intent or (b) have to move the listener). You can see more details here.

share|improve this answer
Thank you for your help. These links have been awesome. The second question I have is once i point my application to the listener, if my db fails over to DB02.FOO and transactions are run against that DB. When the primary comes back up will the changes made to DB02.FOO be mirrored on DB01.FOO or does the mirroring only work one way? – deadLock Jul 5 '12 at 16:12
@SSISPissesMeOff that is explained in the first link as well. – Aaron Bertrand Jul 5 '12 at 16:16
Ah sorry, i should have read it all and not skimmed off the top. Thank you again! – deadLock Jul 5 '12 at 16:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.