导致ORA-39095的两种原因(Expdp)

本文解决了一个expdp导出时遇到的ORA-39095错误,详细分析了错误产生的原因,并提供了两种解决方案:一是减少并行数至1;二是减小filesize大小。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天在群里帮网友处理了一个expdp导出的问题。处理过程如下:

一、搜集报错信息和背景信息

1、报错的截图如下:


2、该网友使用的脚本内容如下:

expdp ceshi/ceshi@odpsceshi directory=expdp_backup dumpfile=ceshi_%u.dmp filesize=1G parallel=5 full=y

创建dir的命令:

 create directory expdp_backup as ’H:/expdp_backup’

h盘还有200多G,而这个库的大小只有10G左右

二、问题分析及解决办法

1、先看下官方的解释:

ORA-39095 :D ump
file space has been exhausted: Unable to allocate string bytes

Cause:
The Export job ran out of dump file space before the job was completed.

Action:
Reattach to the job and add additional dump files to the job restarting the job.

这段话的意思是说%U的数目与filesize的乘积数值仍然小于导出数据实际大小,也就是空间不足的问题。很明显,99*1G远远大于10G,我们这里不是这个原因导致的。

2、继续往上google,发现很多类似错误。其中fenng的博客上有这么一段话说得较清楚(源出处为Oracle Database Utilities官方文档):

http://dbanotes.net/database/_oracle_10gr2_ora-39095_.html

Because each active worker process or I/O server process writes exclusively to one file at a
time, an insufficient number of files can have adverse effects. Some of the worker processes will be idle while waiting for files, thereby degrading the overall performance of the job. 
More
importantly, if any member of a cooperating group of parallel I/O server processes cannot obtain a file for output, then the export operation will be stopped with an ORA-39095 error
.
Both situations can be corrected by attaching to the job using the Data Pump Export utility, adding more files using the ADD_FILE command while in interactive mode, and in the case of a stopped job, restarting the job.

翻译过来意思是:

1)负责写数据到dumpfile文件的进程叫parallel io server processes,而安全机制不允许多个写进程同时写一个dumpfile文件。

2)如果只有一个dumpfile(或少于parallel)就会影响性能,实际上大多数时候,对于小数据库而言,一个dumpfile也无所谓。

3)由于1)中提到的规则,如果此时你的parallel数值大于(实际导出数据量/fileszie)的数值,那么就会有一些进程闲置,他们不能去干活,只能等待。   当一个io server process在不能写dumpfile而不断等待的时候就会报ORA-39095。

3、问题搞清楚了,剩下就好办了,解决办法如下:

parallel<=导出数据量/fileszie

为了实现目的,可以减小parallel,也可以减小filesize。

1)最简单的办法是,减小并行数至1,即修改parallel数值,该值可用范围为1~n.发现不再报错了,但是如果数据量太大,再调整嘛。   最好能计算出实际数据量,可以计算出需要的并行数。

2)减小filesize大小,这个也跟数据量有关的。不废话了。

————————————————————————————————————————————————————

附件: %U参数

附上MOS上查到的相关资料,是关于%U参数所指定的99个dumpfile都不够用的情况下在增加数目的解决办法

Cause

You limited the number of files in DUMPFILE parameter with limited FILESIZE , i.e.:

full=Y
directory=dpump_dir
dumpfile=full_1.dmp,full_2.dmp,full_3.dmp,full_4.dmp
filesize=3000000000

This means max. 4 dump files with file size 3000000000 bytes (4×2.79 GB).

Solution
1. Use the dynamic format  (i.e dumpfile=full_%U.dmp) :

The ‘wildcard’ specification for the dump file can expand up to 99 files. If 99 files have been generated before the export has completed, it will again return the ORA-39095 error.

2. If this is yet not enough and more files are needed, a workaround would be to speciyy a bigger FILESIZE parameter.

3. If this is inconvenient, then another option is to use this syntax:

dumpfile=fullexp%U.dmp, fullexp2_%U.dmp, fullexp3_%U.dmp
which can expand up to 3*99 files.

If encountering problems containing the dump in a single directory using this solution, you may prefer this syntax:

dumpfile=dmpdir1:fullexp1_%U.dmp, dmpdir2:fullexp2_%U.dmp, dmpdir3:fullexp3_U.dmp

附件二:

MOS上查到的跟问题相关的文档

Parallel Export Fails With Error ORA-39095 If There Are Less Specified Files Than Slaves [ID 433391.1]
转到底部
修改时间:2012-5-15类型:PROBLEM状态:PUBLISHED优先级:3
注释 (0)

In this Document
Symptoms
Cause
Solution
References
Applies to:

Oracle Server – Enterprise Edition – Version 10.2.0.1 to 11.2.0.3 [Release 10.2 to 11.2]
Information in this document applies to any platform.
***Checked for relevance on 15-MAY-2012***
Symptoms

When trying to export using PARALLEL clause with one dumpfile, or a number of dumpfile less than the parallelism value.

The export may fail with the following error:

ORA-39095: Dump file space has been exhausted: Unable to allocate 8192 bytes
Cause

When using one dumpfile or a number less than parallelism value, several slave processes wait for the file locked by the other process to write. And so we are not benefiting from the parallelism anyway.Sometimes the slave process locking the file does not release
the lock after finishing as it’s supposed to release the lock when the dump process ends, and it’ll not end cause the other processes are waiting to write to the file. 

Solution

1. Use a number of dump files equal to, or more than the parallelism value.

Or:

2. Don’t use PARALLEL clause.

References

@ BUG:3065578 – PARALLEL EXPORT FAILS IF THERE ARE LESS SPECIFIED FILES THAN SLAVES

 
相关内容
 
 
产品
 
Oracle Database Products > Oracle Database > Oracle Database > Oracle Database – Enterprise Edition > Export
 
关键字
 
DUMP FILE;EXPDP;EXPORT;PARALLELISM
 
错误
 
ORA-39095


原文自:http://www.enkj.com/help/newscontent/95566

Oracle数据库错误 `ORA-00932: inconsistent datatypes` 表示在SQL语句执行过程中,Oracle检测到数据类型不一致的问题。这种错误通常发生在操作涉及两个或多个数据类型不兼容的表达式时,例如在比较、赋值或函数调用中使用了不匹配的数据类型。 ### 常见原因 1. **数据类型不匹配**:在SQL语句中,某些操作要求操作数具有相同的数据类型。例如,在 `UNION` 或 `UNION ALL` 操作中,不同查询的列数据类型必须一致。 2. **隐式转换失败**:当Oracle尝试自动将一种数据类型转换为另一种时,如果转换不可行,就会导致此错误。例如,将 `CLOB` 类型的列与 `CHAR` 类型的值进行比较。 3. **视图或包的定义问题**:在升级数据库版本后,某些SQL语法可能不再被支持,尤其是在涉及复杂数据类型(如 `CLOB` 或 `BLOB`)时,可能导致对象(如视图或包)无法编译通过。 4. **导出/导入问题**:在使用 `exp` 工具进行数据导出时,如果涉及 `BLOB` 或 `CLOB` 类型的列,可能会因数据类型不一致而导致导出失败 [^1]。 ### 解决方法 1. **检查SQL语句中的数据类型一致性**:确保在比较、赋值或函数调用中,操作数的数据类型一致。例如,在 `UNION` 操作中,确保所有查询的列具有相同的数据类型。 2. **显式转换数据类型**:如果需要将不同数据类型的操作数进行比较或赋值,可以使用 `TO_CHAR`、`TO_CLOB` 等函数进行显式转换。例如: ```sql SELECT * FROM table_name WHERE TO_CHAR(clob_column) = 'some_value'; ``` 3. **检查视图或包的定义**:如果数据库版本升级后出现此错误,可能需要检查并修改视图或包的定义,确保SQL语法符合新版本的要求。例如,避免在 `SELECT` 查询中使用混淆的列名称 [^3]。 4. **处理导出/导入问题**:在使用 `exp` 工具进行数据导出时,如果遇到 `ORA-00932` 错误,可以尝试使用 `expdp`(数据泵导出)工具替代,或者检查导出参数是否正确 [^4]。 ### 示例代码 以下是一个示例,展示如何在SQL语句中显式转换 `CLOB` 类型为 `CHAR` 类型以避免 `ORA-00932` 错误: ```sql -- 假设有一个表包含CLOB类型的列 CREATE TABLE example_table ( id NUMBER PRIMARY KEY, clob_column CLOB ); -- 插入一条示例数据 INSERT INTO example_table (id, clob_column) VALUES (1, 'example_value'); -- 查询时显式转换CLOB为CHAR SELECT * FROM example_table WHERE TO_CHAR(clob_column) = 'example_value'; ``` ### 总结 `ORA-00932` 错误通常是由于数据类型不一致引起的。解决此问题的关键在于检查SQL语句中的数据类型一致性,并在必要时进行显式转换。此外,在数据库版本升级后,可能需要检查并修改视图或包的定义以确保兼容性 [^1]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值