Share via

sql 2017 avalibilty group cluster failover powershell

Joseph Patrick 641 Reputation points
2020-11-20T17:45:24.797+00:00

We have SCOM 2019 using SQL 2017 in a multi subnet cluster. We are trying to design a BCP/ DR steps to manually failover the operationsDB cluster.

We want this to use PowerShell and have it as a script if possible.
The script would need to write the event to the event log and move the cluster over to the other site.

I have been looking online for references and possible scripts to do this, I have been reviewing the links below. to come up with such actions.

Any help on pointing me to an existing script, providing code logic, etc. would be appreciated, I assume other admins have done this for their environments thus why I am asking about how to script this process to work with little user action for BCP/DR actions.

https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/perform-a-forced-manual-failover-of-an-availability-group-sql-server?view=sql-server-ver15
http://lifeofageekadmin.com/using-powershell-move-cluster-resources-preferred-node/
http://lifeofageekadmin.com/using-powershell-failover-cluster-resources-patching/

System Center Operations Manager
System Center Operations Manager

A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.

Windows for business | Windows Server | Storage high availability | Clustering and high availability
Windows for business | Windows Server | User experience | PowerShell
SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


Answer accepted by question author

Dirk Hondong 1,001 Reputation points
2020-11-20T18:15:02.803+00:00

Hi there,

no complete solution.
I am not a fan of reinventing the wheel, so maybe take a look at the dbatools cmdlets
Especially
http://docs.dbatools.io/#Invoke-DbaAgFailover
That would at least help to failover your availability group(s) easily.

Was this answer helpful?

2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.