日期:2014-05-16  浏览次数:20390 次

oracle数据库间数据快速 复制
一种利用dblink模式:

1 Create public  database link xxxx connect to xxxx identified by  xxxxusing 'xxxx';
--select 'drop table   '||trim(xxxx)||';' from dt_tabinfo where dw_sysid = '0005'
--2 select 'create  synonym '||trim(dw_tabid)||' for TOTALPLANT.'||trim(dw_tabid)||'@mes;' from dt_tabinfo where dw_sysid = '0005'
--select 'select  count(*) from  '||trim(dw_tabid)||' ;' from dt_tabinfo where dw_sysid = '0005'
3  select 'create  table '||trim(dw_tabid)||' as select * from  TOTALPLANT.'||trim(dw_tabid)||'@xxxx;' from dt_tabinfo where dw_sysid = '0005'

4 --执行select出来的sql

5   drop public database link xxxx;


这样就能把另一个数据库的表快速复制过来。

经测试接近200W的表复制大约只要10多秒,数据还是非常快的。

关于数据同步,可以利用oracle的快照模式,是亚秒级的,可以实现双向复制,有用的可以共同讨论。