Get the App
SLTechnology News&Howtos  ›  Database  › 

SQL Server 2017 AlwaysOn on Linux configuration and maintenance (13)

Shulou Source: shulou.com Published: 2022-06-01 21:51:25 10月03日 Update

2.4.2 forced failover

Forced failover is strictly restricted for disaster recovery. If the cluster fails to respond due to a disaster in the primary data center, you cannot use cluster management tools to interact with the cluster, and you may need to force a failover to bypass the external cluster administrator.

Verify that AG resources are no longer managed by the cluster

Set the resource to unmanaged mode on the target cluster node. This command causes the resource agent to stop resource monitoring and management.

Sudo pcs resource unmanage

If the attempt to set the resource to unmanaged mode fails, delete the resource.

Sudo pcs resource delete

Note: when you delete a resource, you also delete all related constraints.

In the SQL Server instance that hosts the secondary copy, set the session context variable external_cluster

EXEC sp_set_session_context @ key = Noble externalized clusterships, @ value = ignorances'

Connect to the SQL Server instance that hosts the secondary copy of the target and use Transact SQL to perform AG failover

ALTER AVAILABILITY GROUP FORCE_FAILOVER_ALLOW_DATA_LOSS

After a forced failover, bring the AG to health before restarting cluster resource monitoring and managing or rebuilding AG resources. Reference: important tasks after forced failover.

Or restart cluster resource monitoring and management

Run the following command to restart cluster resource monitoring and management:

Sudo pcs resource manage sudo pcs resource cleanup

If the cluster resource is deleted, recreate it.

Reference: create AG resources.

Important: do not use the above steps in disaster recovery walkthroughs as they may lose data. Instead, change the asynchronous copy to synchronous and follow the regular manual failover guidelines.

Tags: Resources failures management enforcement monitoring replicas disasters hosting importance commands instances data patterns goals references health upper and lower context events tasks Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS Microsoft Linux Shulou Information