适用于超大表的 SQL Server 事务复制

发布于 2024-07-10 01:01:49 字数 579 浏览 4 评论 0原文

我在相对较慢的 VPN 连接的不同端的两个 SQL Server 之间设置了事务复制。 该设置是标准的“立即加载快照”类型的事情,初始化订阅后要做的第一件事是删除并重新创建订阅者端的所有表,然后开始对所有数据执行 BCP。 问题在于,有几个表中有几百万行,并且该过程要么 a) 花费非常很长的时间,要么 b) 完全失败。 当我查看复制监视器时,我不断收到的消息是:

  • 进程正在运行,正在等待服务器的响应。
  • 查询超时已过期正在
  • 初始化

然后尝试重新启动批量加载过程(跳过已加载的任何 BCP 文件)。

我目前陷入困境,它只是一遍又一遍地这样做。 它已经运行了几天了。

我的问题是:

  1. 由于网络连接速度太慢,我可以做些什么来改善这种情况吗? 也许有一些设置什么的? 我不介意等待很长时间,只要进程不超时即可。

  2. 有更好的方法吗? 也许做一个备份,压缩,复制,然后恢复? 这样,复制过程如何知道在开始应用事务时从哪里开始,因为在我进行备份和将其恢复并在另一端运行之间会发生更新。

I have set up transactional replication between two SQL Servers on different ends of a relatively slow VPN connection. The setup is your standard "load snapshot immediately" kind of thing where the first thing it does after initializing the subscription is to drop and recreate all tables on the subscriber side and then start doing a BCP of all the data. The problem is that there are a few tables with several million rows in them, and the process either a) takes a REALLY long time or b) just flat out fails. The messages I keep getting when I look in Replication Monitor are:

  • The process is running and is waiting for a response from the server.
  • Query timeout expired
  • Initializing

It then tries to restart the bulk loading process (skipping any BCP files that it has already loaded).

I am currently stuck where it just keeps doing this over and over again. It's been running for a couple days now.

My questions are:

  1. Is there something I could do to improve this situation given that the network connection is so slow? Maybe some setting or something? I don't mind waiting a long time as long as the process doesn't keep timing out.

  2. Is there a better way to do this? Perhaps make a backup, zip it, copy it over and then restore? If so, how would the replication process know where to pick up when it starts applying the transactions, since updates will be occurring between the time I make the backup and get it restored and running on the other side.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南汐寒笙箫 2024-07-17 01:01:49

是的。
您可以手动应用初始快照

我已经有一段时间了,但链接(进入 BOL)有设置订阅者的替代方案。

编辑:从 BOL How-tos 中, 从以下位置初始化事务订阅者备份

Yes.
You can apply the initial snapshot manually.

It's been a while for me, but the link (into BOL) has alternatives to setting up the subscriber.

Edit: From BOL How-tos, Initialize a Transactional Subscriber from a Backup

动听の歌 2024-07-17 01:01:49

在 SQL 2005 中,您有一个“紧凑快照”选项,它允许您减少快照的总大小。 当通过网络应用时,快照项目会“传输”压缩到订阅者,然后在订阅者中进行扩展。

我认为您可以通过比较标准快照和压缩快照的大小轻松计算出潜在的速度增益。

顺便说一下,有一个(非常)类似的问题这里用于合并复制,但我认为在快照级别没有区别。

In SQL 2005, you have a "compact snapshot" option, that allow you to reduce the total size of the snapshot. When applied over a network, snapshot items "travel" compacted to the suscriber, where they are then expanded.

I think you can easily figure the potential speed gain by comparing sizes of standard and compacted snapshots.

By the way, there is a (quite) similar question here for merge replication, but I think that at the snapshot level there is no difference.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文