bestxiaok 发表于 2013-1-14 08:56:17

oracle数据库间数据快速 复制

一种利用dblink模式:

1 Create publicdatabase link xxxx connect to xxxx identified byxxxxusing 'xxxx';
--select 'drop table   '||trim(xxxx)||';' from dt_tabinfo where dw_sysid = '0005'
--2 select 'createsynonym '||trim(dw_tabid)||' for TOTALPLANT.'||trim(dw_tabid)||'@mes;' from dt_tabinfo where dw_sysid = '0005'
--select 'selectcount(*) from'||trim(dw_tabid)||' ;' from dt_tabinfo where dw_sysid = '0005'
3select 'createtable '||trim(dw_tabid)||' as select * fromTOTALPLANT.'||trim(dw_tabid)||'@xxxx;' from dt_tabinfo where dw_sysid = '0005'

4 --执行select出来的sql

5   drop public database link xxxx;


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

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

关于数据同步,可以利用oracle的快照模式,是亚秒级的,可以实现双向复制,有用的可以共同讨论。
页: [1]
查看完整版本: oracle数据库间数据快速 复制