Oracle 11.2.0.4 数据泵expdp导出含CLOB字段(basicfile)的表超级慢的问题

0    498    3

Tags:

👉 本文共约4094个字,系统预计阅读时间或需16分钟。

简介

在 11.2.0.4 上 expdp导出含有CLOB字段的大表时会非常慢,而且可能会发生ora-01555错误。该错误的解决办法见:https://www.dbaup.com/oracleshujubengexpdpdaochubaoora-01555heora-22924.html#ke_neng_yuan_yin_er ,但是导出仍然会很慢,解决办法只能是重建表,然后修改存储属性STORE AS securefile,再进行导出才会解决慢的问题。

Oracle 11g专门针对LOB字段的新特性securefile,这是在11g推出的新的LOB存储模式,之前的版本都是以basicfile方式存储LOB字段,securefile于basicfile相比,对LOB的读取和写入操作的效率均有明显提高,但却需要占用更多的磁盘空间,但也多的有限,基本可以忽略不计。在11g版本,默认的LOB存储模式还是basicfile,如果使用securefile,需要在建表的时候指定或者数据库securefile相关的参数才可以,个人建议LOB都以securefile存储。

启用SecureFiles 存储

使用DB_SECUREFILE 初始化参数,数据库管理员(DBA) 可确定SecureFiles 的使用情况,其中有效值为:
• ALWAYS :尝试将所有LOB 创建为SecureFile LOB,但是仅可将自动段空间管理(ASSM) 表空间外的任何 LOB 创建为BasicFile LOB
• FORCE:强制将所有LOB 创建为SecureFile LOB
• PERMITTED:允许创建SecureFiles (默认值)
• NEVER:禁止创建SecureFiles
• IGNORE :禁止创建SecureFiles ,并忽略使用SecureFiles 选项强制创建BasicFiles 而导致的任何错误
如果指定了NEVER,则任何指定为SecureFiles 的LOB 均被创建为BasicFiles。如果对BasicFiles 使用任何SecureFiles 特定的存储选项和功能(如压缩、加密和取消重复),则会导致异常错误。将对任何未指定的存储选项使用BasicFiles 默认值。如果指定了ALWAYS ,则系统中创建的所有LOB 均会被创建为SecureFiles 。必须在ASSM 表空间中创建LOB ,否则会发生错误。将忽略所有指定的BasicFiles 存储选项。可以使用

ALTER SYSTEM 命令更改所有存储的SecureFiles 默认值,如幻灯片中所示。也可以通过单击“Server (服务器)”选项卡中的“Initialization Parameters (初始化参数)”链接来使用Enterprise Manager 设置参数。

修改参数:

Evaluate the following command:
SQL>ALTER SYSTEM SET db_securefile = 'IGNORE';
What is the impact of this setting on the usage of SecureFiles?
A. It forces BasicFiles to be created even if the SECUREFILE option is specified to create the LOB.
B. It forces SecureFiles to be created even if the BASICFILE option is specified to create the LOB.
C. It does not allow the creation of SecureFiles and generates an error if the SECUREFILE option is
specified to create the LOB.
D. It ignores the SECUREFILE option only if a Manual Segment Space Management tablespace is used and creates a BasicFile.
Answer: A

示例

获取表结构:

表的大小:

可见,表才15g,但是clob字段就41g。

重新建立临时表,将STORE AS BASICFILE修改为STORE AS securefile

然后导入数据:

等待导入完成后,然后继续进行导出:

可见,速度提升很快。

DataPump Export (EXPDP) Is Taking Long time To Export Tables With BASICFILES (Doc ID 1595380.1)

APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.3 to 12.1.0.2 [Release 11.2 to 12.1]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Information in this document applies to any platform.

SYMPTOMS

Datapump export is taking more than the double time after a database upgrade from 10.2.0.4 to 11.2.0.3

In our example, one table with a LOB column takes more than 18 hours. The rest of the objects are exported within 30 mins.
Here is the current size of the table with a blob column based on the output of the export..

. . exported ""."" 408.8 GB 173268 rows

本人提供Oracle(OCP、OCM)、MySQL(OCP)、PostgreSQL(PGCA、PGCE、PGCM)等数据库的培训和考证业务,私聊QQ646634621或微信dbaup66,谢谢!
AiDBA后续精彩内容已被站长无情隐藏,请输入验证码解锁本文!
验证码:
获取验证码: 请先关注本站微信公众号,然后回复“验证码”,获取验证码。在微信里搜索“AiDBA”或者“dbaup6”或者微信扫描右侧二维码都可以关注本站微信公众号。

标签:

Avatar photo

小麦苗

学习或考证,均可联系麦老师,请加微信db_bao或QQ646634621

您可能还喜欢...

发表回复