Pregunta

SQL server version is SQL Version 2016

Current setup is two nodes in primary having always on availability group. Adding a 3rd node which is DR(Disaster and Recover).

Does anyone knows a power shell script that automates failover from primary to DR once Primary(1st and 2nd node) becomes unavailable.

¿Fue útil?

Solución

There is good change that you need to fix your Quorum first (so that the cluster service can run and that the listener and the AG's databases can be used) See : https://docs.microsoft.com/en-us/sql/sql-server/failover-clusters/windows/force-a-wsfc-cluster-to-start-without-a-quorum?view=sql-server-ver15#:~:text=Failover%20Cluster%20Manager-,To%20force%20a%20cluster%20to%20start%20without%20a%20quorum,Force%20my%20cluster%20to%20start.

Once your cluster is back up, then you will have to trigger a failover of your AG with allow_data_loss : https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-availability-group-transact-sql?view=sql-server-ver15

I would be really cautious with such a script as it may cause data Loss. You should also plan the "how to" to get back to your normal DC once the outtage is fix.

This is the kind of thing you probably want to practice on so I strongly recommand that you get some non-prod VM to set it up and test it.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a dba.stackexchange
scroll top