[AlwaysOn] 创建SQL Server高可用性组T-SQL语法:FAILURE_CONDITION_LEVEL参数

来源:这里教程网 时间:2026-03-02 11:28:07 作者:

FAILURE_CONDITION_LEVEL = { 1 | 2 | 3 | 4 | 5 }

指定触发此可用性组的自动故障转移的故障条件。Specifies what failure conditions trigger an automatic failover for this availability group. 参数 FAILURE_CONDITION_LEVEL在组级别设置,但仅与为同步提交的可用性模式(AVAILABILITY_MODE = SYNCHRONOUS_COMMIT)配置的可用性副本相关。FAILURE_CONDITION_LEVEL is set at the group level but is relevant only on availability replicas that are configured for synchronous-commit availability mode (AVAILABILITY_MODE = SYNCHRONOUS_COMMIT). 此外,只有将主副本和辅助副本都配置为自动故障转移模式(FAILOVER_MODE = AUTOMATIC),并且辅助副本当前与主副本同步时,故障条件才能触发自动故障转移。Furthermore, failure conditions can trigger an automatic failover only if both the primary and secondary replicas are configured for automatic failover mode (FAILOVER_MODE = AUTOMATIC) and the secondary replica is currently synchronized with the primary replica.

失效条件等级(1-5)的范围从限制性最低的1级到限制性最强的5级。The failure-condition levels (1-5) range from the least restrictive, level 1, to the most restrictive, level 5. 给定的条件级别包含所有限制性较小的级别。A given condition level encompasses all the less restrictive levels. 因此,最严格的条件级别5包括四个限制性较小的条件级别(1-4),级别4包括级别1-3,等等。Thus, the strictest condition level, 5, includes the four less restrictive condition levels (1-4), level 4 includes levels 1-3, and so forth. 下表描述了对应于每个级别的故障条件。The following table describes the failure-condition that corresponds to each level.

级别 Level

  失效条件 Failure Condition

1

指定在发生以下任一情况时应启动自动故障转移: Specifies that an   automatic failover should be initiated when any of the following occurs:

- SQL Server 服务已关闭 The SQL Server service   is down.

- 用于连接到WSFC群集的可用性组的租约将过期,因为没有从服务器实例收到ACK。 The lease of the availability group for connecting to the WSFC cluster expires   because no ACK is received from the server instance. 有关详细信息,请参阅它的工作原理:SQL   Server总是处于租用超时状态。 For more information, see How It Works: SQL   Server Always On Lease Timeout.

2

指定在发生以下任一情况时应启动自动故障转移: Specifies that an   automatic failover should be initiated when any of the following occurs:

- SQL Server 实例未连接到群集,并且超出了可用性组的用户指定的健康检查超时阈值。 The instance of SQL   Server does not connect to cluster, and the user-specified   HEALTH_CHECK_TIMEOUT threshold of the availability group is exceeded.

- 可用性副本处于失败状态。 The availability replica is in failed state.

3

指定应在关键的SQL Server内部错误(如孤立的spinlocks、严重的写访问冲突或转储过多)上启动自动故障转移。 Specifies that an automatic failover should be initiated on critical SQL   Server internal errors, such as orphaned spinlocks, serious write-access   violations, or too much dumping.

This is the default   behavior.

4

指定应在中度SQL Server内部错误(如SQL Server内部资源池中的永久性内存不足)时启动自动故障转移。 Specifies that an automatic failover should be initiated on moderate SQL   Server internal errors, such as a persistent out-of-memory condition in the   SQL Server internal resource pool.

5

指定应在任何限定的故障条件下启动自动故障转移,包括: Specifies that an   automatic failover should be initiated on any qualified failure conditions,   including:

- SQL 引擎工作线程耗尽。 Exhaustion of SQL   Engine worker-threads.

- 检测到无法解决的死锁。 Detection of an unsolvable deadlock.

注释 Note

SQL Server 实例对客户端请求的响应不足与可用性组无关。Lack of response by an instance of SQL Server to client requests is not relevant to availability groups.

故障条件级别( FAILURE_CONDITION_LEVEL)和运行状况检查超时) HEALTH_CHECK_TIMEOUT)值,为给定组定义灵活的故障转移策略。The FAILURE_CONDITION_LEVEL and HEALTH_CHECK_TIMEOUT values, define a flexible failover policy for a given group. 这种灵活的故障转移策略为您提供了对哪些条件必须导致自动故障转移的精细控制。This flexible failover policy provides you with granular control over what conditions must cause an automatic failover. 有关详细信息,请参阅针对可用性组(SQL Server)的自动故障转移的灵活故障转移策略。For more information, see Flexible Failover Policy for Automatic Failover of an Availability Group (SQL Server).

相关推荐