如何在 SQL Server 2000 数据库发布的订阅者上手动应用快照
我正在尝试在物理上远程且连接速度较慢的两台 SQL Server 计算机之间创建复制。
因此,我想手动将快照文件夹移动到订阅者,而不是让它通过慢速连接进行复制。我想知道要在订阅者上成功应用快照应遵循的步骤。
I am trying to create replication between two SQL Server machines that are physically remote and have a slow connection between them.
So I want to manually move the snapshot folder to the subscriber instead of letting it copy over the slow connection. I would like to know the steps to follow in order to successfully apply the snapshot on the subscriber.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这会很棘手。当您启动快照时,您将在日志中放置一个标记,说明快照的生成时间,以便一旦在订阅者处应用快照,分发代理就知道从哪个点开始传递复制的命令。因此,您不仅需要应用快照,还需要以某种方式告诉复制它已经被传递,并从正确的时间开始传递命令。
但要回答你的问题,快照只是一系列平面文件。有一些 .pre 文件只是 T-SQL,应该首先运行(我喜欢使用 sqlcmd 或 osql,因为我可以从命令行编写脚本)。接下来是 .sch 文件,也是 T-SQL。接下来是数据文件(我不记得这些文件的文件扩展名了)。它们是 bcp“本机”格式。因此,您将使用“bcp db.schema.table in file -n -T -S server -b1000”之类的内容来应用它们。最后是 .idx 文件,它们又是 T-SQL。除了数据文件之外的所有文件都是人类可读的,因此您可以查看它们在做什么(没什么花哨的,但总是很高兴知道)。祝你好运。
I think that's going to be tricky. When you initiate a snapshot, you're placing a mark in the log that says when the snapshot was generated so that once the snapshot is applied at the subscriber, the distribution agent knows from which point to start delivering replicated commands. So you not only have to apply the snapshot, but somehow tell replication that it's already been delivered and to start delivering commands from the right time.
But to answer your question, the snapshot is just a series of flat files. There are .pre files which are just T-SQL and should be run first (I like using sqlcmd or osql for this since I can script it out from the command line). Next are the .sch files which are also T-SQL. Next are the data files (I don't remember the file extension for these off the top of my head). They are bcp "native" format. So you're going to apply them with something like "bcp db.schema.table in file -n -T -S server -b1000". Finally are the .idx files which are T-SQL again. All but the data files are human-readable so you can look at what they're doing (nothing fancy, but always good to know). Good luck.