Cannot insert duplicate key row in object 'MSmerge_genhistory' with unique index 'unc1MSmerge_genhistory'

[ 2008-06-20 02:01:43 | 作者: progame ]
文字大小: | |
To fix this problem, I did the following:

1. First found the duplicate generation(s):

select generation

from msmerge_genhistory

group by generation

having count(*) > 1

2. Then I scripted an update from the msmerge_contents table just to be safe (all of my tables have the column "last_modified". You will need to change this to an appropriate column):

select 'update ' + a.name + ' set last_modified = last_modified where rowguid = ' +''''+ cast(c.rowguid as nvarchar(40)) + ''''

from msmerge_contents c

join sysmergearticles a

on c.tablenick = a.nickname

where generation = 4784219

3. Then I deleted 1 of the rows from msmerge_genhistory for that generation.

4. Replication worked fine after that.

5. Run the update script created in step 2 on the publisher to reissue the updates.

Step 2 and 5 might be unnecessary. But i included it just in case.

在第二步时, msmerge_contents 找不到这个generation的数据, 于是只好直接做第三步
评论Feed 评论Feed: /feed.asp?q=comment&id=1734

您可能感兴趣的文章:


这篇日志没有评论.

发表
表情图标
[smile] [confused] [cool] [cry]
[eek] [angry] [wink] [sweat]
[lol] [stun] [razz] [redface]
[rolleyes] [sad] [yes] [no]
[heart] [star] [music] [idea]
UBB代码
转换链接
表情图标
悄悄话
用户名:   密码:   (非注册用户不需要输入密码) 注册?
验证码(不区分大小写) * 请输入验证码