- 創建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