Alwayson 与 mirror

时间:2022-01-19 15:22:16

--将主副本改为同步模式和自动故障转移,将其中一个辅助副本改为同步辅助副本和自动故障转移

USE [master]
GO
ALTER AVAILABILITY GROUP [TESTDB5AG]
MODIFY REPLICA ON N'SINGLE1' WITH (AVAILABILITY_MODE = SYNCHRONOUS_COMMIT)
GO
ALTER AVAILABILITY GROUP [TESTDB5AG]
MODIFY REPLICA ON N'SINGLE1' WITH (FAILOVER_MODE = AUTOMATIC)
GO

USE [master]
GO
ALTER AVAILABILITY GROUP [TESTDB5AG]
MODIFY REPLICA ON N'SINGLE2' WITH (AVAILABILITY_MODE = SYNCHRONOUS_COMMIT)
GO
ALTER AVAILABILITY GROUP [TESTDB5AG]
MODIFY REPLICA ON N'SINGLE2' WITH (FAILOVER_MODE = AUTOMATIC)
GO

--节点接管 同步辅助副本上 执行接管操作,如single2上
ALTER AVAILABILITY GROUP [TESTDB5AG] FAILOVER;