Expdp 很慢 impdp很快
又要签一个合同,毕竟还是很happy的事。
签合同之前,客户抛出来一个小问题,是的,对将要进行的合同来说,这个问题绝对只是九牛一毛。这是个问题是,客户一个比较关键、但是中小型的数据库(数据文件100G以内),导出花了1个多小时,导入只要5分钟。导出导入的工具是用的Oracle10gR2的expdp,数据库是Oracle10.2.0.4 ,平台是AIX5300TL4. EXpdp慢的问题,让我想起了南京事件(http://www.zhihong.org/nanjing_expdp_image.html)。
当时是一个expdp 时快时慢的问题,消耗了数家高手而未决,最后花了我一个周末的case。 今天的情况明显不同,因为这次是一直慢。通过测试,发现是其中的带有lob字段的一张大表比较慢。既如是,事情就比较好办了,先看看是否有相关的bug。

Jacky查到了如下bug:

Bug 5599947 – Export Data Pump is slow when table has a LOB column
- Defect: Bug 5599947 “DATAPUMP EXPORT VERY SLOW”
-Symptoms:Export Data Pumphas low performance when exporting table with LOB column
- Releases: 11.1.0.6 and below
- Fixed in: not applicable, closed as not feasible to fix
- Patched files: not applicable
- Workaround: if possible re-organize the large table with LOB column and make it partitioned
- Cause: if a table has a LOB column, and the unload or load takes place in “External Tables” mode, then we cannot make use of parallel I/O execution Processes (PX processes)
- Trace: not applicable
- Remarks: see also Bug 5943346 “PRODUCT ENHANCEMENT: PARALLELISM OF DATAPUMP JOB ON TABLE WITH LOB COLUMN”

方案可以比较简单,这张lob表用传统的方式exp/imp,其余的用expdp,导出的使用使用exclude选项。当然,如果嫌麻烦,1小时也不是太长的时间。