首页 > 数据库 > Oracle > 11g_Datapump
11g中,Data Pump也有一点新功能,还挺有用的。
10g中compression参数:
COMPRESSION=(METADATA_ONLY | NONE)
METADATA_ONLY =〉results in all metadata being written to the dump file in compressed format. This is the default.
NONE =〉disables compression for the entire unload.
11g中这个参数有4个值:
COMPRESSION={ALL | DATA_ONLY | METADATA_ONLY | NONE}
ALL =〉 enables compression for the entire export operation.
DATA_ONLY =〉 results in all data being written to the dump file in compressed format.
METADATA_ONLY =〉 results in all metadata being written to the dump file in compressed format. This is the default.
NONE =〉disables compression for the entire export operation.
关于这4个备选值效果,作如下测试。
SQL> create directory dpump_dir as 'd:';
Directory created.
D:>expdp scott/tiger directory=dpump_dir dumpfile=scott1.dmp compression=all
Time: 89s(14:33:01 -- 14:34:30)
Bytes: 9,396,224 SCOTT1.DMP
D:>expdp scott/tiger directory=dpump_dir dumpfile=scott2.dmp compression=metadata_only logfile=scott_exp_metadata.log
Time: 36s(14:37:26 -- 14:38:02)
Bytes: 19,492,864 SCOTT2.DMP
D:>expdp scott/tiger directory=dpump_dir dumpfile=scott3.dmp compression=data_only logfile=scott_exp_data.log
Time: 37s(14:39:33 -- 14:40:10)
Bytes: 9,441,280 SCOTT3.DMP
D:>expdp scott/tiger directory=dpump_dir dumpfile=scott4.dmp logfile=scott_none.log
Time: 35s(14:40:58 -- 14:41:33)
Bytes: 19,492,864 SCOTT4.DMP
D:>expdp scott/tiger directory=dpump_dir dumpfile=scott5.dmp compression=all logfile=scott_exp_all.log
Time: 46s(14:51:09 -- 14:51:45)
Byets: 9,396,224 SCOTT5.DMP
第五次测试和第一次测试,用相同的参数,生成dump文件大小也一致,但是用的时间差别很大(分别是89秒和46秒,后面还有一次是37秒)。经过分析和随后多次测试,认定原因是第一次expdp的时候,数据是从数据文件里读取出来的,而后面的expdp的操作,数据是从cache读取出来的。
由上可见:
1. COMPRESSION参数选择DATA_ONLY或者ALL的时候,压缩率的达50%以上(在ORACLE网站上看到别人做的结果是压缩率在80%以上),压缩比例还是很高的。
2. COMPRESSION参数选择不同的值,expdp所需时间差别不大。
这个功能肯定会在开发人员和dba中间流行。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/207/viewspace-1027315/ ,如需转载,请注明出处,否则将追究法律责任。