Set-SqlAvailabilityGroup
This cmdlet modifies settings on an existing availability group.
Set-SqlAvailabilityGroup [-InputObject*] <AvailabilityGroup> [-AutomatedBackupPreference<AvailabilityGroupAutomatedBackupPreference>] [-FailureConditionLevel <AvailabilityGroupFailureConditionLevel>][-HealthCheckTimeout <int>] [-Script] [<CommonParameters>]
Set-SqlAvailabilityGroup [[-Path] <string>] [-AutomatedBackupPreference<AvailabilityGroupAutomatedBackupPreference>] [-FailureConditionLevel <AvailabilityGroupFailureConditionLevel>][-HealthCheckTimeout <int>] [-Script] [<CommonParameters>]
The Set-SqlAvailabilityGroup cmdlet modifies the AutomatedBackupPreference, FailureConditionLevel, and HealthCheckTimeout settings on an existing availability group. This cmdlet can be executed only at the server instance that hosts the primary replica.
Parameters |
---|
-AutomatedBackupPreference <AvailabilityGroupAutomatedBackupPreference>
|
-FailureConditionLevel <AvailabilityGroupFailureConditionLevel>
|
-HealthCheckTimeout <int>
|
-InputObject <AvailabilityGroup>
|
-Path <string>
|
-Script [<SwitchParameter>]
|
<CommonParameters>
|
Examples
- This command sets the HealhCheckTimeout property on the availability group ‘MyAg’ to 120,000 milliseconds (two minutes):
C:PS> Set-SqlAvailabilityGroup -Path SQLSERVER:SqlPrimaryServerInstanceNameAvailabilityGroupsMyAG -HealthCheckTimeout 120000
If the primary server is unresponsive for this length of time and automatic failover is enabled, an automatic failover will be initiated.
- This command sets the AutomatedBackupPreference property on the availability group ‘MyAg’ to ‘SecondaryOnly’:
C:PS> Set-SqlAvailabilityGroup -Path SQLSERVER:SqlPrimaryServerInstanceNameAvailabilityGroupsMyAg -AutomatedBackupPreference SecondaryOnly
Automated backups of databases in this availability group will never occur on the primary replica, but will be redirected to the secondary replica with the highest backup priority (see the BackupPriority property of availability replicas).
- This command sets the FailureConditionLevel property on the availability group ‘MyAg’ to ‘OnServerDown’:
C:PS> Set-SqlAvailabilityGroup -Path SQLSERVER:SqlPrimaryServerInstanceNameAvailabilityGroupsMyAg -FailureConditionLevel OnServerDown
This means that when the server instance hosting the primary replica goes offline and automatic failover is enabled, an automatic failover will be initiated.
Additional Notes
Related Links