数据库“<dbname>”的远程副本与数据库</dbname>的本地副本无关

时间:2013-10-03 18:24:22

标签: sql-server-2012 high-availability

我正在尝试在本文之后将辅助数据库加入我的SQL Server 2012可用性组:

Join a Secondary Database to an Availability Group (SQL Server)

当我尝试这个时,本地SQL服务器窗口事件日志给出错误1407:

The remote copy of database "<DBNAME>" is not related to the local copy of the database

我已按照所有步骤操作,并使用NORECOVERY创建了最近的备份和恢复。

目标SQL Server的错误日志会出现以下错误:

AlwaysOn: The local replica of availability group '<AGNAME>' is going offline because the corresponding resource in the Windows Server Failover Clustering (WSFC) cluster is no longer online. This is an informational message only. No user action is required.

The state of the local availability replica in availability group '<AGNAME>' has changed from 'SECONDARY_NORMAL' to 'RESOLVING_NORMAL'. The replica state changed because of either a startup, a failover, a communication issue, or a cluster error. For more information, see the availability group dashboard, SQL Server error log, Windows Server Failover Cluster management console or Windows Server Failover Cluster log. 

The state of the local availability replica in availability group '<AGNAME>' has changed from 'RESOLVING_NORMAL' to 'NOT_AVAILABLE'. The replica state changed because of either a startup, a failover, a communication issue, or a cluster error. For more information, see the availability group dashboard, SQL Server error log, Windows Server Failover Cluster management console or Windows Server Failover Cluster log. 

群集及其所有节点都在线。 AG仪表板不提供任何其他信息来帮助诊断问题。

打开所有防火墙并没有解决问题。

Windows事件日志提供以下行:

The database 'DelphiOBUDB' is marked RESTORING and is in a state that does not allow recovery to be run.

但是,当您还原数据库时,数据库将处于还原模式,并根据教程指南指定NORECOVERY标志。

如何将数据库加入我的可用性组?

1 个答案:

答案 0 :(得分:0)

问题与在重新运行powershell脚本以重新创建可用性组之前删除数据库有关。

尝试使用相同的数据库名称时,我也看到了这个错误:

Add-SqlAvailabilityDatabase : The connection to the primary replica is not active.  The command cannot be processed.

答案是执行powershell脚本以使用新的和不同的数据库名称创建数据库和可用性组。