Hi All,
Need a query help.
I am running SQL 2014 2-node AlwaysON Availability groups, Enterprise Edition in our environment
and 5 databases are part of AG.
Question is, sometimes AG is getting failed over to node2 but always our preferred node is node1 due to some business needs otherwise some of our jobs will fail.
So, what I looking for is, a sql script which can handle a situation wherein, for some reason, AG is failed over to node2, it should be able to detect if node1 is back online or not and if so, it should failback to node1. How to do this using tsql query
or stored proc or sql agent job ?
Thanks in advance.