环境:
REDHAT 5.4 8核8G
表a 7.2G 3600万记录
首先看下备份
###############################################################################################
PG环境下
autovacuum = off
maintaince_work_mem = 2G
1,pg_dump db -U user -t a >pg_a_p.sql
pg_a_p.sql
文件约5.8G,时间175秒
pg_a.p.sql文件就是一个可以立即执行的SQL脚本
2,pg_dump db -U user -t a -F c >pg_a_c.sql
pg_a_c.sql
文件约1.4G,时间482秒
pg_a_c.sql为乱码,只能通过pg_restore来恢复
关于pg_dump输出文件格式可参考官方文档,默认-F p,这里不详细解释了。
###############################################################################################
ORACLE环境下
1,exp user/password tables=a
file=ora_a.dmp
ora_a.dmp 文件约7G,时间638秒
2,exp user/password tables=a file=ora_a_d.dmp direct=y
ora_a_d.dmp
文件月7G,时间205秒
3,expdp user/password directory=d(事先建好) tables=a
file=ora_a_dp.dmp
ora_a_dp.dmp
文件大小约6G,时间163秒
4,若cpu较空闲
expdp user/password
directory=d(事先建好) tables=a
file=ora_a_dp_pa.dmp parallel=7
ora_a_dp_pa.dmp
文件大小约6G,时间137秒
###############################################################################################
由此可见,在逻辑备份上PG较ORACLE还是有一定优势的,看重效率可用pg_dump -F
p,看重压缩比(在不同服务器间迁移dump文件)可用pg_dump -F c
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
接下来看下恢复,环境同上
PG环境
1,psql db -U user -f pg_a_p.sql
时间552秒
2,pg_restore -d db -U user pg_a_c.sql
时间452秒
###############################################################################################
ORACLE环境
1,imp user/password tables=a file=ora_a.dmp
时间463秒
2,impdp user/password directory=d dumpfile=ora_a_dp.dmp
时间165秒
##############################################################################################
可见,逻辑恢复的时效性方面,ORACLE具有一定优势。
通常,实际应用中会较多地用到数据的迁移,以及新DB环境的搭建,所以上述的实验具有一定参考价值。
而对于物理备份,ORACLE有冷备份及RMAN等,PG有pg_rman,以及pg_start_backup()等,通常时间较长,且恢复过程麻烦。往往会做,但高可用性方面一般不通过备份来保证(恢复时间及过程不可接受)。PG会采用stream
duplication;ORACLE会采用RAC和DATAGUARD来保证。