Ekinlikler
31 Mar 23 - 2 Nis 23
En büyük SQL, Fabric ve Power BI öğrenme etkinliği. 31 Mart – 2 Nisan. 400 ABD doları tasarruf etmek için FABINSIDER kodunu kullanın.
Bugün kaydolunBu tarayıcı artık desteklenmiyor.
En son özelliklerden, güvenlik güncelleştirmelerinden ve teknik destekten faydalanmak için Microsoft Edge’e yükseltin.
Applies to:
SQL Server
This topic describes how to change the failover mode of an availability replica in an Always On availability group in SQL Server by using SQL Server Management Studio, Transact-SQL, or PowerShell. The failover mode is a replica property that determines the failover mode for replicas that run under synchronous-commit availability mode. For more information, see Failover and Failover Modes (Always On Availability Groups) and Availability Modes (Always On Availability Groups).
This task is supported only on primary replicas. You must be connected to the server instance that hosts the primary replica.
SQL Server Failover Cluster Instances (FCIs) do not support automatic failover by availability groups, so any availability replica that is hosted by an FCI can only be configured for manual failover.
Requires ALTER AVAILABILITY GROUP permission on the availability group, CONTROL AVAILABILITY GROUP permission, ALTER ANY AVAILABILITY GROUP permission, or CONTROL SERVER permission.
To change the failover mode of an availability replica
In Object Explorer, connect to the server instance that hosts the primary replica, and expand the server tree.
Expand the Always On High Availability node and the Availability Groups node.
Click the availability group whose replica you want to change.
Right-click the replica, and click Properties.
In the Availability Replica Properties dialog box, use the Failover mode drop list to change the failover mode of this replica.
To change the failover mode of an availability replica
Connect to the server instance that hosts the primary replica.
Use the ALTER AVAILABILITY GROUP statement, as follows:
ALTER AVAILABILITY GROUP *group_name* MODIFY REPLICA ON '*server_name*'
WITH ( {
AVAILABILITY_MODE = { SYNCHRONOUS_COMMIT | ASYNCHRONOUS_COMMIT }
| FAILOVER_MODE = { AUTOMATIC | MANUAL }
} )
In the preceding script:
group_name is the name of the availability group.
server_name is either the computer name or the failover cluster network name. For named instances add `\instance_name'. Use the name that hosts the replica that you want to modify.
For more information about these parameters, see ALTER AVAILABILITY GROUP (Transact-SQL).
The following example, entered on the primary replica of the MyAG availability group, changes the failover mode to automatic failover on the availability replica that is located on the default server instance on a computer named COMPUTER01.
ALTER AVAILABILITY GROUP MyAG MODIFY REPLICA ON 'COMPUTER01' WITH
(FAILOVER_MODE = AUTOMATIC);
To change the failover mode of an availability replica
Change directory (cd) to the server instance that hosts the primary replica.
Use the Set-SqlAvailabilityReplica cmdlet with the FailoverMode parameter. When setting a replica to automatic failover, you might need to use the AvailabilityMode parameter to change the replica to synchronous-commit availability mode.
For example, the following command modifies the replica MyReplica
in the availability group MyAg
to use synchronous-commit availability mode and to support automatic failover.
Set-SqlAvailabilityReplica -AvailabilityMode "SynchronousCommit" -FailoverMode "Automatic" `
-Path SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MyAg\Replicas\MyReplica
Not
To view the syntax of a cmdlet, use the Get-Help cmdlet in the SQL Server PowerShell environment. For more information, see Get Help SQL Server PowerShell.
To set up and use the SQL Server PowerShell provider
Overview of Always On Availability Groups (SQL Server)
Availability Modes (Always On Availability Groups)
Failover and Failover Modes (Always On Availability Groups)
Ekinlikler
31 Mar 23 - 2 Nis 23
En büyük SQL, Fabric ve Power BI öğrenme etkinliği. 31 Mart – 2 Nisan. 400 ABD doları tasarruf etmek için FABINSIDER kodunu kullanın.
Bugün kaydolunEğitim
Modül
Azure Cosmos DB'de çoğaltmayı yapılandırma ve yük devretmeleri yönetme - Training
Azure Cosmos DB'de çoğaltmayı yapılandırma ve yük devretmeleri yönetme
Sertifikasyon
Microsoft Sertifikalı: Azure Veritabanı Yöneticisi Uzmanlık - Certifications
Microsoft PaaS ilişkisel veritabanı tekliflerini kullanarak bulut, şirket içi ve karma ilişkisel veritabanları için SQL Server veritabanı altyapısını yönetme.
Belgeler
Change availability mode of a replica for an availability group - SQL Server Always On
A description for how to change the availability mode of an availability replica within an Always On availability group using either Transact-SQL (T-SQL), PowerShell, or SQL Server Management Studio.
Perform a planned manual failover of an availability group - SQL Server Always On
This topic describes how to perform a planned manual failover of an Always On availability group.
Manually force a failover of an availability group - SQL Server Always On
This topic describes how to perform a forced failover of an Always On availability group (with possible data loss) by using either Transact-SQL (T-SQL), PowerShell, or SQL Server Management Studio.