如何在 SQL Server 2005 中跟踪订阅服务器的复制行的时间? [英] How do you track the time of replicated rows for Subscribers in SQL Server 2005?

查看:44
本文介绍了如何在 SQL Server 2005 中跟踪订阅服务器的复制行的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本问题是这样的:
订阅者使用事务复制成功地从发布者复制了一行.现在,我们如何跟踪上次成功复制该行的时间?

The basic problem is like this:
A subscriber has successfully replicated a row from the publisher, using transactional replication. Now, how do we keep track the time of this row being last successfully replicated?

一位朋友提出了以下解决方案,他将其用于他的 SQL Server 2000:
1) 添加日期时间列.
2)更改复制存储过程以更新日期时间列(!).

A friend has suggested the following solution, which he used for his SQL Server 2000:
1) Add a datetime column.
2) Change the replication stored procedure to update the datetime column (!).

第 2 步在我心中敲响了警钟,所以在我详细介绍他的解决方案之前,我想问问在这种情况下是否有更好的 SQL Server 2005 解决方案.

The step #2 sets off all sorts of warning bells within me, so I'm asking if there are better solutions for SQL Server 2005 in this situation, before I even go into detail with his solution.

推荐答案

我会完全按照你朋友的建议去做.这样,只有调用复制过程才会更新时间戳.

I'd do exactly what your friend suggested. That way, only calls to the replication procedure would update the timestamp.

这种方法的问题是你需要一个写锁,但我看不到任何其他实用的方法.

The problem with this approach is that you need a write lock, but I don' see any other practical way.

否则,您可以使用在获取行时触发的触发器(不要引用我的话,我很少使用触发器),但这似乎不对(您可能会以误报结束)

You could otherwise use a trigger that fires when you fetch the row (don't quote me on that, I very seldom used triggers), but that doesn't seem right (you might end with false positives)

这篇关于如何在 SQL Server 2005 中跟踪订阅服务器的复制行的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆