Поделиться через


Set-SqlAvailabilityGroup

Sets settings on an availability group.

Синтаксис

ByPath (по умолчанию)

Set-SqlAvailabilityGroup
    [[-Path] <String>]
    [-AutomatedBackupPreference <AvailabilityGroupAutomatedBackupPreference>]
    [-FailureConditionLevel <AvailabilityGroupFailureConditionLevel>]
    [-HealthCheckTimeout <Int32>]
    [-DatabaseHealthTrigger <Boolean>]
    [-Script]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByObject

Set-SqlAvailabilityGroup
    [-InputObject] <AvailabilityGroup>
    [-AutomatedBackupPreference <AvailabilityGroupAutomatedBackupPreference>]
    [-FailureConditionLevel <AvailabilityGroupFailureConditionLevel>]
    [-HealthCheckTimeout <Int32>]
    [-DatabaseHealthTrigger <Boolean>]
    [-Script]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Описание

The Set-SqlAvailabilityGroup cmdlet modifies settings on an existing availability group in AlwaysOn Availability Groups. You can modify the automated backup preference, the failure condition level, and the health check timeout. You must run this cmdlet on the server instance that hosts the primary replica.

Примеры

Example 1: Change the health check timeout period

PS C:\> Set-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MAinAG" -HealthCheckTimeout 120000

This command changes the health check timeout property on the availability group named MainAG to 120,000 milliseconds, or two minutes. If automatic failover is enabled, after this length of time, AlwaysOn Availability Groups initiates an automatic failover will be initiated.

Example 2: Change automated backup preference

PS C:\> Set-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG" -AutomatedBackupPreference SecondaryOnly

This command changes the automated backup preference on the availability group named MainAG to be SecondaryOnly. Automated backups of databases in this availability group do not occur on the primary replica. Instead, automated backups occur on the secondary replica that has the highest backup priority.

Example 3: Change the failure condition level

PS C:\> Set-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG" -FailureConditionLevel OnServerDown

This command changes the failure condition level on the availability group named MainAG to be OnServerDown. If the server instance that hosts the primary replica goes offline and if automatic failover is enabled, AlwaysOn Availability Groups starts an automatic failover.

Параметры

-AutomatedBackupPreference

Specifies the automated backup preference for the availability group. The acceptable values for this parameter are:

  • Primary. Specifies that the backups always occur on the primary replica. This option supports the use of features not available when backup runs on a secondary replica, such as differential backups.
  • SecondaryOnly. Specifies that backups are never performed on primary replicas. If the primary replica is the only replica online, the backup does not occur.
  • Secondary. Specifies that backups occur on secondary replicas, unless the primary replica is the only replica online. Then the backup occurs on the primary replica.
  • None. Specifies that the primary or secondary status is not taken into account when deciding which replica performs backups. Instead, backup priority and online status determine which replica performs backups.

Свойства параметра

Тип:AvailabilityGroupAutomatedBackupPreference
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Свойства параметра

Тип:SwitchParameter
Default value:False
Поддерживаются подстановочные знаки:False
DontShow:False
Aliases:cf

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-DatabaseHealthTrigger

The Set-SqlAvailabilityGroup cmdlet modifies settings on an existing availability group in AlwaysOn Availability Groups. You can modify the automated backup preference, the failure condition level, and the health check timeout. You must run this cmdlet on the server instance that hosts the primary replica.

Свойства параметра

Тип:Boolean
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-FailureConditionLevel

Specifies the automatic failover behavior of the availability group. The acceptable values for this parameter are:

  • OnServerDown. Failover or restart if the SQL Server service stops.
  • OnServerUnresponsive. Failover or restart if any condition of lower value is satisfied, plus when the SQL Server service is connected to the cluster and the HealthCheckTimeout threshold is exceeded, or if the availability replica currently in primary role is in a failed state.
  • OnCriticalServerError. Failover or restart if any condition of lower value is satisfied, plus when an internal critical server error occurs, which include out of memory condition, serious write-access violation, or too much dumping.
  • OnModerateServerError. Failover or restart if any condition of lower value is satisfied, plus if a moderate Server error occurs, wich includes persistent out of memory condition.
  • OnAnyQualifiedFailureConditions. Failover or restart if any condition of lower value is satisfied, plus if a qualifying failure condition occurs, which includes engine worker thread exhaustion and unsolvable deadlock detected.

Свойства параметра

Тип:AvailabilityGroupFailureConditionLevel
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-HealthCheckTimeout

Specifies the length of time, in milliseconds, after which AlwaysOn Availability Groups declares an unresponsive server to be unhealthy.

Свойства параметра

Тип:Int32
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-InputObject

Specifies the availability group, as an AvailabilityGroup object, that this cmdlet modifies.

Свойства параметра

Тип:AvailabilityGroup
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByObject
Position:2
Обязательно:True
Значение из конвейера:True
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Path

Specifies the path of the availability database that cmdlet modifies. If you do not specify this parameter, this cmdlet uses current working location.

Свойства параметра

Тип:String
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByPath
Position:2
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Script

Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.

Свойства параметра

Тип:SwitchParameter
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Свойства параметра

Тип:SwitchParameter
Default value:False
Поддерживаются подстановочные знаки:False
DontShow:False
Aliases:wi

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.