复制期间在哪里存储临时数据?
我刚刚开始尝试复制我们的系统,不确定如何最好地处理这个问题。
我想过滤数据,但它不像“where columnName = 'abc'”那么简单。因此,我正在编写一个大型复杂的过程,用于确定将复制每个表中的哪些记录。我将每个表的 PK 存储在临时表中。我设想 pre_snapshot_script 将创建并填充这些表,而 post_snapshot_script 将删除它们。这些表的过滤器语句会读取类似“where PK in (select pk_id from temp table)”的内容
。我可以把这些数据放在哪里?我是否需要在数据库中创建持久表才能将它们标记为复制?我假设任何 #temp 或 ##temp 表都不起作用。
I've just started playing around with Replicating our system and am not sure how best to handle this issue.
I want to filter data, but its not as easy as "where columnName = 'abc'". So I'm writing a big complicated process that is determining which records from each table are going to be replicated. I'm storing the PKs for each table in temp tables. I envisioned that the pre_snapshot_script would create and populate these tables and the post_snapshot_script would delete them. The filter statements for these tables then read something like "where PK in (select pk_id from temp table)"
So. Where can I put this data? Do I need to make persistent tables in my database in order to have them marked for replication? I assume any #temp or ##temp tables won't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你的PK(从表中选择PK)的想法可能是正确的。
你是对的,它需要是一个持久表。您能否提供有关该场景的更多细节?您是否每小时/每天/每周生成快照?之后会进行任何事务复制吗?你使用什么样的逻辑?
这些答案可能有助于阐明其他解决方案或帮助验证您的初始路径是否正确。
I think you're PK in (select PK from table) idea may be correct.
You're right that it would need to be a persistent table. Can you provide a little more detail on the scenario? Are you generating snapshots hourly/daily/weekly? Any transactional replication going on after? What sort of logic are you using?
These answers might help illuminate other solutions or help verify that your initial path was the correct one.