首页 > oracle知识 > oracle备份 >

ora-39064:无法写入日志文件;ora-29285:文件写入错误

作者: 初见博客 分类: oracle备份,oracle报错 发布时间: 2021-07-23 10:11

windows平台下,oracle 11.2.0.1在使用impdp向测试环境导入数据的时候,报出如下错误:

e8928855df73a6b68b11aaf5ce81b6a1

错误原因:

数据泵在写日志文件的时候,使用的是数据库字符集。如果客户端的环境变量NLS_LANG得值和数据库字符集不一致的话,日志中显示的表名称可能和终端屏幕输出的不一致。
数据泵内部使用的是包UTL_FILE,在和NLS转换的时候可能不能输出字符。

解决方法:

1、查看数据库字符集

SQL> select userenv(‘language’) from dual;

USERENV(‘LANGUAGE’)
————————————————-
SIMPLIFIED CHINESE_CHINA.AL32UTF8

2、查看操作系统的NLS_LANG设置:

打开注册表(regedit),进入HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb11g_home1,查看NLS_LANG键值为SIMPLIFIED CHINESE_CHINA.ZHS16GBK;

3、将客户端NLS_LANG的值设置和数据库字符集一致,将

SIMPLIFIED CHINESE_CHINA.ZHS16GBK

修改为:

SIMPLIFIED CHINESE_CHINA.AL32UTF8

如图所示:

7c4f64634351fe53bffe4ea06a401cd1

经过搜索mos,有如下的文章给出了解决方案:
Error ORA-39064 Might Be Encountered By DataPump Export (EXPDP) When NLS_LANG Is Different From Database Character Set (Doc ID 1321034.1)

在该方案中给出的解决方案是:Please set the character set in environment variable NLS_LANG to database character set.

以下全文转载该mos文章,不做翻译:

Applies to:
Oracle Database – Enterprise Edition – Version 10.1.0.2 and later
Information in this document applies to any platform.
***Checked for relevance on 15-Apr-2013***
Symptoms
In a multi-byte character set environment, if the client variable NLS_LANG is set to a character set which is different from database the character set, then DataPump export may encounter errors like:

ORA-39064: unable to write to the log file
ORA-29285: file write error

The Utilities manual specifies:

“Note: Data Pump Export writes the log file using the database character set. If your client NLS_LANG environment setting sets up a different client character set from the database character set, then it is possible that table names may be different in the log file than they are when displayed on the client output screen.”

Cause
This was investigated in Bug 6136923 (closed as ‘Not a Bug’) with reference to unpublihsed documentation bug 3174256.
DataPump internally uses the package UTL_FILE and this does not correctly return the characters during NLS conversion.

Solution
Please set the character set in environment variable NLS_LANG to database character set.

The following information was added to manual:

Oracle Database PL/SQL Packages and Types Reference
Using UTL_FILE:

“When data encoded in one character set is read and Globalization Support is told (such as by means of NLS_LANG) that it is encoded in another character set, the result is indeterminate. If NLS_LANG is set, it should be the same as the database character set.”

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注