本帖最后由 sotom 于 2011-05-23 12:26:41 编辑

解决方案 »

  1.   


    意思表示为如下首先
    INSERT INTO tab_a (b.id,c.name)
            SELECT FROM tab_b@dblink_b b,tab_c c WHERE b.id=c.id;
    注意,此时的tab_a和tab_c是同一个数据库下的,这里的比较操作在tab_c所在数据库进行,因为tab_c记录数是千万级的,而tab_b记录很少
    然后在insert到tab_a@dblink_b
    insert into tab_a(id,name) select id,name from tab_a@dblink_c
      

  2.   

    --如果远端数据量大,而本地数据量很小,并且返回数据量小
    --可以使用 HINT将远端表作为驱动表,也就是将本地表发送到远端比较后,再返回结果
    INSERT INTO tab_a (b.id,c.name)
            SELECT /*+driving_site(c)*/ * FROM tab_b b,tab_c@dblink_c  c WHERE b.id=c.id;
      

  3.   


    谢谢楼上的,呵呵,这个很有用, 我在其他论找到点资料,如果有想理解的可以看看
    Oracle manual has all the answers. It's not always doing the join on the local side. The temporary table part in your guess is incorrect (except in very rare cases).Please read
    http://download.oracle.com/docs/ ... 02/b14231/part7.htm
    and many other books of the documentation, such as those under the heading "distributed databases" at
    http://www.oracle.com/pls/db102/master_index?letter=d#index-DI