如何使物理分布数据的外键关系? [英] how to make foreign key relationship on physically distributed data?

查看:112
本文介绍了如何使物理分布数据的外键关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • 三个服务器

  • 服务器1是链接其他两个服务器的中心点。

  • 其他两个服务器有一个表格应该像外键一样行使



问题



好吧,我不知道该怎么做,使用vs08或sql server 08



图表视图



服务器1上的表


sv1pg1 id - 主键
详细信息


表srvr2和srvr3上的相同模式


linkedSRVid - pk
linkedto - - fk约束应该在(服务器1主键和此字段之间)


注意



这只是一个最简单的方式,我可以想到代表prob,真正的dbs包含



许多字段和表,以下适用于




  • 服务器之间的网络连接并不总是保持不变。





  • 链接只需要连接到相应的服务器。

    解决方案

    外键约束只能引用其他表 在同一个数据库 。这意味着即使这些数据库位于同一个服务器上仍然无法正常工作。



    考虑到模式相同,您可能需要查看 复制


    • three servers
    • server 1 is central point which links the other two servers.
    • the other two servers have a table which has a field which should act like a foreign key

    problem

    well i do not know how to do this, using vs08 or sql server 08

    diagram view

    table on server 1

    sv1pg1 id -- primary key details

    tables same schema on srvr2 and srvr3

    linkedSRVid -- pk linkedto -- fk constrain should be between (server 1 primary key and this field)

    note that

    "this is just a simplest! way i can think of to represent the prob, the real dbs contain

    many fields and tables and the following applies"

    • it's not always that the network connection between the server remains up.

    • the link only need for "writing purpose" not viewing, as viewing done by direct

    connection to the respective server.

    解决方案

    A foreign key constraint can reference other tables only within the same database. This means that even if those databases were on the same server it still would not work.

    Considering that the schemas are the same, you may want to look into replication.

    这篇关于如何使物理分布数据的外键关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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