在两台测试服务器部署了复制(发布订阅)后,发现订阅的表一直没有同步过来。重新生成过snapshot ,也重新初始化过订阅,都不能同步数据,后面检查Distributor To Subscriber History, 发现有如下日志信息:
The concurrent snapshot for publication 'RPL_PUB_Tecdb' is not available because it has not been fully generated or the Log Reader Agent is not running to activate it. If generation of the concurrent snapshot was interrupted, the Snapshot Agent for the .....
这个可能是因为以前配置过这个数据库的发布订阅,但是由于某些原因,没有清理干净。我参考网上http://stackoverflow.com/questions/1018339/the-concurrent-snapshot-for-publication-xx-is-not-available-because-it-has-not的解决方案 ,连续测试了几个发布订阅,都能完美解决这个问题,特此记录一下,方面以后遇到该问题能顺速解决。
1:首先删除对应的发布订阅(publication & subscription ).
2: 查看关于发布订阅的一些信息
SELECT *
FROM msdb..MSdistpublishers;
SELECT *
FROM distribution..MSpublisher_databases;
SELECT *
FROM distribution..MSpublications;
SELECT *
FROM distribution..MSarticles;
SELECT *
FROM distribution..MSsubscriptions;
其实这里面只需要查看distribution..MSpublisher_databases、distribution..MSarticles 、distribution..MSsubscriptions
3: 从MSarticles、MSsubscriptions 中删除对应的数据
DELETE FROM distribution..MSarticles
WHERE publisher_db = '<NameOfDatabase>';
DELETE FROM distribution..MSsubscriptions
WHERE publisher_db = '<NameOfDatabase>';
4: 重新创建发布、订阅。问题解决。
参考资料: