没有共享存储和仲裁盘的SQL Server 2012HADR故障手动切换TSQL
---恢复内容开始--- 没有共享存储和仲裁盘的SQL Server 2012HADR故障手动切换TSQL 因为一些原因有些SQLSERVER集群中没有配置仲裁盘,只有一主一辅两个实例。 配置如下: USE [master] GO CREATE AVAILABILITY GROUP [ak51DB] WITH (AUTOMATED_BACKUP_PREFERE
---恢复内容开始---
没有共享存储和仲裁盘的SQL Server 2012HADR故障手动切换TSQL
因为一些原因有些SQLSERVER集群中没有配置仲裁盘,美国空间,只有一主一辅两个实例。
配置如下:
USE [master] GO CREATE AVAILABILITY GROUP [ak51DB] WITH (AUTOMATED_BACKUP_PREFERENCE = SECONDARY) FOR DATABASE [ak51Activity],[ak51Load] REPLICA ON N'ak51-DB35' WITH (ENDPOINT_URL = N'TCP://ak51-DB35.580top.com:5022', FAILOVER_MODE = MANUAL, AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT, SESSION_TIMEOUT = 10, BACKUP_PRIORITY = 100, PRIMARY_ROLE(ALLOW_CONNECTIONS = ALL), SECONDARY_ROLE(ALLOW_CONNECTIONS = ALL)), N'ak51-DB36' WITH (ENDPOINT_URL = N'TCP://ak51-DB36.580top.com:5022', FAILOVER_MODE = MANUAL, AVAILABILITY_MODE = SYNCHRONOUS_COMMIT, SESSION_TIMEOUT = 10, BACKUP_PRIORITY = 50, PRIMARY_ROLE(ALLOW_CONNECTIONS = ALL), SECONDARY_ROLE(ALLOW_CONNECTIONS = NO)); GO
这时候是不具备SQL Server 2012 Always on的自动故障转移条件的 但是它万一出现主机故障时,需要手动强起辅机的 脚本很简单:
ALTER AVAILABILITY GROUP [ak51db] FORCE_FAILOVER_ALLOW_DATA_LOSS;
需要注意的是:如果是异步提交,强起辅机可能会有数据丢失
当主机重新连线时,美国空间,再切回来后,会发现高可用性组处于“未同步"状态
这时候需要运行TSQL重新恢复可用性组:
ALTER DATABASE [ak51Load] SET HADR RESUME; ALTER DATABASE [ak51Activity] SET HADR RESUME;
至于我为什么不选用高可用性侦听组和仲裁盘的原因,这里很复杂。。。
原文:
---恢复内容结束---
---恢复内容开始---
没有共享存储和仲裁盘的SQL Server 2012HADR故障手动切换TSQL
因为一些原因有些SQLSERVER集群中没有配置仲裁盘,只有一主一辅两个实例。
配置如下:
USE [master] GO CREATE AVAILABILITY GROUP [ak51DB] WITH (AUTOMATED_BACKUP_PREFERENCE = SECONDARY) FOR DATABASE [ak51Activity],[ak51Load] REPLICA ON N'ak51-DB35' WITH (ENDPOINT_URL = N'TCP://ak51-DB35.580top.com:5022', FAILOVER_MODE = MANUAL, AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT, SESSION_TIMEOUT = 10, BACKUP_PRIORITY = 100, PRIMARY_ROLE(ALLOW_CONNECTIONS = ALL), SECONDARY_ROLE(ALLOW_CONNECTIONS = ALL)), N'ak51-DB36' WITH (ENDPOINT_URL = N'TCP://ak51-DB36.580top.com:5022', FAILOVER_MODE = MANUAL, AVAILABILITY_MODE = SYNCHRONOUS_COMMIT, SESSION_TIMEOUT = 10, BACKUP_PRIORITY = 50, PRIMARY_ROLE(ALLOW_CONNECTIONS = ALL), SECONDARY_ROLE(ALLOW_CONNECTIONS = NO)); GO
这时候是不具备SQL Server 2012 Always on的自动故障转移条件的 但是它万一出现主机故障时,需要手动强起辅机的 脚本很简单:
ALTER AVAILABILITY GROUP [ak51db] FORCE_FAILOVER_ALLOW_DATA_LOSS;
需要注意的是:如果是异步提交,强起辅机可能会有数据丢失
当主机重新连线时,再切回来后,会发现高可用性组处于“未同步"状态
这时候需要运行TSQL重新恢复可用性组:
ALTER DATABASE [ak51Load] SET HADR RESUME; ALTER DATABASE [ak51Activity] SET HADR RESUME;
至于我为什么不选用高可用性侦听组和仲裁盘的原因,网站空间,这里很复杂。。。
原文:
---恢复内容结束---