有一张表,有15个BLOB字段,每个BLOB字段中存放150-300字节的数据,换算下来一条记录有3950个字节,
现在表中有70万条数据,用exp命令把这张表中的数据导出到dump文件中
(导出时exp命令用的参数:DIRECT=Y COMPRESS=N ROWS=Y)导出dump文件大小3.2G,用时80分钟(效率太低了)
为了证明是因为BLOB字段的原因,导出效率才如此之低,现在把这种表中的BLOB字段都换成VARCHAR2,放同样的数据,
然后执行同样的exp命令,导出的文件也是3.2G左右,但是只用了4分钟,效率大大提高请问为什么BLOB字段的导出效率如此之低?有什么好的提高导出性能的解决办法吗(主要针对表中含有大量BLOB类型的字段时)?在此谢谢大家了!

解决方案 »

  1.   

    设置BUFFER好象没有什么效果, 网上看到的资料:Export Parameters
    This section contains descriptions of the Export command-line parameters.BUFFER
    Default: operating system-dependent. See your Oracle operating system-specific documentation to determine the default value for this parameter.Specifies the size, in bytes, of the buffer used to fetch rows. As a result, this parameter determines the maximum number of rows in an array fetched by Export. Use the following formula to calculate the buffer size:buffer_size = rows_in_array * maximum_row_sizeIf you specify zero, the Export utility fetches only one row at a time.Tables with columns of type LOBs, LONG, BFILE, REF, ROWID, LOGICAL ROWID, or DATE are fetched one row at a time.Note:The BUFFER parameter applies only to conventional path Export. It has no effect on a direct path Export. For direct path Exports, use the RECORDLENGTH parameter to specify the size of the buffer that Export uses for writing to the export file.
    Example: Calculating Buffer Size
    This section shows an example of how to calculate buffer size.The following table is created:CREATE TABLE sample (name varchar(30), weight number);The maximum size of the name column is 30, plus 2 bytes for the indicator. The maximum size of the weight column is 22 (the size of the internal representation for Oracle numbers), plus 2 bytes for the indicator.Therefore, the maximum row size is 56 (30+2+22+2).To perform array operations for 100 rows, a buffer size of 5600 should be specified.
    特别是这一句:Tables with columns of type LOBs, LONG, BFILE, REF, ROWID, LOGICAL ROWID, or DATE are fetched one row at a time.
    oracle在导出的过程中对于含lob行是row by row,所以时间会很长。看来没法了, 如果是oracle10g还好,可以用expdp,但是数据库是9i,只能用exp