1. 在A库中创建dblink连接到B库
create database link dblink_name
connect to user identified by pwd
using service_name ; --B库的用户名和密码,连接字符串2. insert into test_a select * from test_a@dblink_name where ...
create database link dblink_name
connect to user identified by pwd
using service_name ; --B库的用户名和密码,连接字符串2. insert into test_a select * from test_a@dblink_name where ...
然后,查询一个表中的内容,插入另一个表(insert into test_a select * from test_a@dblink_name)
另外一个问题是,不知道你的表数据量有多大,如果有个几十万的,
建议使用中间表:
create table temp_table as select * from test_a@dblink_name where ..(clause);
这样可以大大提高效率.