采用plsql建立dblink
右键-新建
验证是否建立成功
select * from [email protected];(t_yy目标库表名 ,dblink是link的名字)
merge into [email protected] b using t_yy c on (b.id=c.id)
当目标库id和源库的id一致 则让目标库和源库的数据一致
when matched then update set b.name=c.name
否则将源库的整条数据插入到目标库
when not matched then
insert values(c.id,c.name);
[email protected] 目标库的表@link名称
t_yy源库表名