对多个服务器运行查询?
我不确定这个问题的最佳设计模式是什么,因此任何建议将不胜感激。我有两个 SQL Server A
(带有 DB P、Q、R)和 B
(带有 DB X、Y、Z)。
从命令行将服务器 A
上的表与服务器 B
上的表进行联接的有效方法是什么?基本上,我正在尝试自动执行长期运行的查询列表,但不太确定如何继续。
编辑:我无法控制服务器,也不是管理员。
I am not sure what the best design pattern for this problem is so any suggestions would be greatly appreciated. I have two SQL Servers A
(with DBs P,Q,R) and B
(with DBs X,Y,Z).
What is an efficient way to do a join of tables situated on Server A
with those on Server B
from command-line? Basically, I am trying to automate a long running list of queries and am not really sure how to proceed.
EDIT: I do not have control over the servers and am not an admin.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
至少我会在两台服务器之间创建一个链接服务器。使用诸如 OPENROWSET 之类的东西会比使用链接服务器慢。
根据您需要这些查询运行的速度,您可能会考虑使用一个夜间进程将数据从服务器 A 复制到服务器 B(或反之亦然),这样您就不必担心跨服务器的问题。
At a minimum I would create a Link Server between the two servers. Using something like OPENROWSET will be slower than using a Link Server.
Depending on how fast you need these queries to run you might consider having a nightly process that copies the data from Server A to Server b (or the other way around) so that you don't need to worry about cross server.
无法跨不同服务器执行联接。您可以使用这些服务器之上的集群解决方案来为您完成此操作,也可以自己完成此操作 - 从一张表中读取数据,然后在代码中手动执行连接。
There is no way of performing a join across different servers. You can either use a cluster solution on top of those servers to do it for you, or you can do it by yourself - reading from one table, and performing the join manually in your code.