※ 引述《charleshu (Analog Engineer)》之銘言:
: ※ 引述《ienchen227 (..)》之銘言:
: : 請問一下,
: : 我有A,B兩台 Oracle Database10g Server,裡面有相同的資料表。
: : 我想使用JAVA撰寫程式,
: : 使使用者可選擇A資料庫部分資料表將資料複製到B資料庫的資料表。
: : 我原來的作法是,開兩個Connect將A資料庫資料表資料讀出暫存,
: : 再將其寫入到B資料庫資料表。
: : 不過效能很差。
: : 請問版上大大是否有更好的方法?
: : 謝謝!!
: 可以從B建一個connection到A
: 然後以 create table xxx as select xxx from yyy@A
: 或是 insert into xxx select xxx from yyy@A where ...
At A :
create user oracle identified by oracle;
grant select any table to oracle;
grant connect to oracle;
At B:
create public database link test connect to oracle identified by oracle
using 'A';
'A'這個定義 記得要寫入tnsnames.ora
At B:
--verify
select * from dual@test;
複製表格:
create table table_name as select * from table_name@test;
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.166.193.13
※ 編輯: iamnotfat 來自: 118.166.193.13 (08/10 00:04)