Risks of manual failover in Always On Availability Groups

clip art of 
 a double-quote character

Question

In my environment, I have SQL 2014 with Always On Availability Group for databases in asynchronous with manual fail over.

We have 1 primary and 2 secondary replicas–secondary1 and sec2.

I have to do failover from primary to secondary1. I know some data loss will happen as it is a forced failover.

My questions:

  • What will be prerequisite for this?
  • Can we do in busy hours or after busy hours?
  • Is there any risk involved during failover.

Appreciate your suggestions as first time I will do failover.

asked 2017-02-09 by user2011956


Answer

If you fail over to a secondary replica that is not synchronized, you will experience data loss. The amount of lost data would vary depending on how much latency you have at that exact minute. There is not guaranteed data loss–just the potential for it. For example, if the databases are idle, your asynchronous secondary replica might be in sync, and you would have no data loss.

If there is data loss in any of your AG databases (yes, it’s possible for only some DBs in an AG to see data loss), those databases will not be able to resume data movement between replicas after the failover with data loss. You will need to tear down from & re-initialize those databases back into the AG in order to resume data movement.

If you are doing a planned failover, simply do the following steps:

  1. switch the secondary replica to be synchronous
  2. wait for data movement to catch up
  3. fail over with zero data loss
  4. switch back to asynchronous mode

Derik Hammer has a blog on using PowerShell to perform (and automate) this process:
http://www.sqlhammer.com/availability-group-fail-over-test-with-powershell/

answered 2017-02-09 by Andy Mallon