1 replication-replication distribution subsystem agent null failed. the publication xxx does not exist 从字面上可以看到,当前订阅的发布已经不存在了,而相应的分发代理却因为某些原因没有被删除,继续运行,就会出现这种错误。 这个错误可以在distr
1
replication-replication distribution subsystem agent null failed. the publication xxx does not exist
从字面上可以看到,当前订阅的发布已经不存在了,而相应的分发代理却因为某些原因没有被删除,继续运行,就会出现这种错误。
这个错误可以在distributor的错误日志中,或者msrepl_errors表中看到.
a1 如何解决:在distributor服务器中的分发数据库中执行如下语句
select publisher,subscriber from mssubscriber_info
上面的查询列出“发布”与订阅”的对照关系,但实际上对我们排错并没有什么作用,因为此时订阅的信息很可能已经从mssubscriber_info中删除了,你无法的找到到底是哪些’subscriber’在进行这种无效的请求.我们能做的也只有凭借记忆找出到底那些可能的订阅者了…
找到可能的订阅,检查其对应的job的隶属记录:
就可以将对应的订阅删除了
2
pull模式下,在复制监视器中看到大量的”为分发的命令”,检查distribution agent对应的作业,查看其历史记录,发现如下错误:
agent message code 20084. the process could not connect to distributor 'xxxxx'.
在distributor的errorlog找到distribution agent帐号登录失败的信息。
解决方法 为distribution agent帐号在distirbutor创建登录
3
2011-04-03 17:37:05.853 connecting to distributor ‘xxx’
the remote server %s does not exist, or has not been designated as a valid publisher, or you may not have permission to see available publishers.
解决方法:可能是publisher已经无法连接,或者缺少权限。确定distribution agent帐号是否属于pal,如果不是则添加
exec sp_help_publication_access @publication = n'publicationname'
会列出pal的成员
4
在push模式下,分发代理出现如下错误:
agent message code 14260. you do not have sufficient permission to run this command. contact your system administrator
检查是否符合如下条件:
distribution agent for a push subscription
the windows account under which the agent runs is used when it makes connections to the distributor. this account must:
· at minimum be a member of the db_owner fixed database role in the distribution database.
· be a member of the pal.
· have read permissions on the snapshot share.
· have read permissions on the installation directory of the ole db provider for the subscriber if the subscription is for a non-sql server subscriber.
the account that is used to connect to the subscriber must at minimum be a member of thedb_owner fixed database role in the subscription database, or have equivalent permissions if the subscription is for a non-sql server subscriber.
5
查看复制监视器/dbo.msrepl_errors
遇到如下错误:
尝试的命令:
if @@trancount > 0 rollback tran
(事务序列号: 0x0000003a000001db006800000000,命令 id:3)
错误消息:
· 应用复制的命令时在订阅服务器上找不到该行。 (源: mssqlserver,错误号: 20598)
获取帮助: http://help/20598
· 应用复制的命令时在订阅服务器上找不到该行。 (源: mssqlserver,错误号: 20598)
获取帮助: http://help/20598
出现这种错误的原始可能是:订阅服务器中的一个数据行a被(误)删除了,而发布服务器要修改/删除a这条记录,顺利删除后要将结果更新到订阅,此时订阅服务器中a已经不存在了…
可以在distributor上执行如下语句,获得具体错误信息
sp_browsereplcmds '0x0000003a000001db006800000000','0x0000003a000001db006800000000'
从上面的截图可以看出,一个删除100行数据的语句在发布库执行, 将相应的信息传递到分发后,分发库调用100次sp_msdel_dbotx来完成数据的同步. 从之前的错误信息进一步看到,其中的第三条语句执行时到了问题:
分发代理在执行sp_msdel_dbotx这条语句后出现了上述的错误。sp_msdel_dbotx这个存储过程的定义是在将对象添加到发布是定义的。默认的命名规则是sp_ms+operation+schemaname+tablename
可以通过下面这个查询定位到具体表
use [distribution]
select *from msarticles where article_id=@article_id
具体的定义可以在subscriber的订阅库中查看
use [subdbname]
exec sp_helptext [sp_msdel_dbota]
解决方式是将删除的行在订阅中重新插入,主键就是sp_msdel_dbota里的参数。
6
cannot drop the database xxx because it is being used for replication
exec sp_removedbreplication 'database'