• 创建dblink
-- Create database link 
create shared database link COPYCITY_BZTOMY
connect to db_A identified by db_A
authenticated by db_B identified by db_B
using '192.168.0.141/orcl';             --说明有两个数据库db_A密码db_A和db_B密码db_B  该SQL语句在db_A中执行,表示在db_A中可以使用b_B中的表
  • 检查dblink是否可用

select * from b_djb@COPYCITY_BZTOMY   --假设表b_djb在db_B库中,那么我们在db_A 库中执行以上SQL语句,检查是否能正常查询db_B中的数据
  • 如果有clob字段创建临时表,先赋值给临时表,最后将临时表赋值给目标表,如果没有clob字段直接跳到最后一步操作
--创建临时的 商城信息表
--drop table city_scspxxb_temp
truncate table 
create global temporary table city_scspxxb_temp as 
select *
from city_scsbxxb ;
  • 将数据导入到临时表中
insert into city_scspxxb_temp select * from city_scsbxxb@COPYCITY_BZTOMY where city_scspxxid='27405'  --加条件
  • 将临时表的数据导入目标库
insert into city_scsbxxb@COPYCITY_BZTOMY select * from city_scspxxb_temp
posted on 2018-11-13 13:21  许一朵岁月  阅读(4536)  评论(0编辑  收藏  举报