Wednesday, 7 May 2014

Fail all Availibility Groups to local node

Use this to fail over AG's back to the local node.

select 'ALTER AVAILABILITY GROUP ['+name+'] FAILOVER;
go'
from sys.availability_groups
order by name desc