日期:2014-05-16 浏览次数:20410 次
在同一个服务器上有两个数据库A和B,现在想取B数据库中的某个表中的数据插入到A中,做法是:
1、首先在A数据库中建立一个dblink,其中testLink是dblink名字随便取,username跟password都是B数据库的登录名跟密码;
create public database link testLink connect to username identified BY password using '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.230)(PORT = 1521)) (LOAD_BALANCE = yes) (FAIL_OVER = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )';
Insert into Table2(field1,field2,...) select value1,value2,... from Table1
insert into T_ZD_XZQH (id,dm,czbz,jc,qc,pyt) select seq_t_zd_mz.nextval,d.dm,'1',d.jc,d.qc,d.pyt from PSBW_D_XZQH@wbblink.regress.rdbms.dev.us.oracle.com d where d.bs='y';