APPLIES TO:

PL/SQL - Version 9.2.0.8 and later
Information in this document applies to any platform.
*** Checked for relevance on 26th Dec 2018 ***

SYMPTOMS

1. Error occurs only when reading a file using UTL_FILE. 
 
 
ERROR at line x:
ORA-29284: file read error
ORA-06512: at line x 
 
Where x can be any line number. 
 
 
2. Truss file shows a block of file is read and subsequent blocks cannot be read or corrupted because of NLS (ORA_NLS10) settings.  
 
For example truss file can show one or several of the following symptoms during or after the first read of block size of 1024: 
 
 
file read error 
file write error 
internal error 
invalid maximum line size 
invalid file name 
directory access denied 
invalid offset specified for seek 
file remove operation failed 
file rename operation failed 
A stream error occurred during compression or uncompression. 
A data error occurred during compression or uncompression. 
invalid mime header tag 
invalid encoded string 
The compressed representation is too big
 
 
3. Incorrect Directory path at Database and OS. 
 
4. Incorrect file format.  i.e., Integrity of the file is the being read or write.  

CHANGES

- New application using UTL_FILE to read file. 
- Existing application roll over after parameter change. 
- Changes in environment (.profile file or spfile or init files or APPS environment) affecting NLS related settings change. 

CAUSE

Conflict with the ORA_NLS10 settings.  These changes are hard to detect when there's a .profile file or spfile or init files or APPS environment are involved.  Session level settings do not have any impact on UTL_FILE because UTL_FILE is a server side package.  Truss files can pickup the actual settings used but still it does not show what character set was actually used when the Listener was originally started or when the Database was originally started.  
 
ORA_NLS10 setting is often a cause for ORA-29283 error, and that the error may very well be intermittent due to dynamic effect of ORA_NLS10.
 
Bug 6748861 (Not a Bug), Bug 9322463 (Not a Bug) and Bug 6164955 (APPS) - Incorrect ORA_NLS10 environment setting.  
 
Additional details on how to generate a truss can be found in the MOS Document  Note 28588.1  Using Truss/Trace on Unix.

SOLUTION

1. When making changes to the ORA_NLS10 environment variable, be it to set or unset.  It has to be consistent at Database (DB) and Listener level.  NLS level settings changed using ALTER SYSTEM are not effective for UTL_FILE.   UTL_FILE spawns the settings from the DB and the listener when it was originally started.  Changes at initialization file (spfile or init) are effective when the DB is bounced and listener is restarted.  
 
a. The Database (DB) must be stopped and restarted after the change. 
 
b. The Oracle listener must be stopped and restarted after the change. 
 
If you are not sure about the current ORA_NLS10 or if there are any inconsistency between the time of when the listener was originally started.  Unset the ORA_NLS10 at listener level.  
 
 
- Depending on your OS: unset ORA_NLS10 (or) export ORA_NLS10= 
 
- echo $ORA_NLS10; -- it should not give any value 
 
- lsnrctl stop <listener name>
 
- lsnrctl start <listener name>
 
 
Mostly issues raise when there are inconsistent ORA_NLS10 language setting.  
 
c. The Application must be stopped and restarted after the change. 
 
To ensure that all process are using the same settings.  
 
2. It is our understanding that DIRECTORY at DB and OS are having correct settings because the write or read file error can also occur because of incorrect directory settings.  If not, please check and make sure the DIRECTORY settings are fine.   
 
 
For example: 
 
SQL> create directory TESTDIR as '/testcases/3-1596154591sr';
 
SQL> grant read,write on directory TESTDIR to public;
 
 
 
Where TESTDIR is the DIRECTORY name used in the Application or PL/SQL object which tries to read/write from a physical and existing directory on the same server with the required permissions at OS level.  
 
OS level having 777 permissions to read and write to that particular directory. 
 
 
For example: 
 
chmod 777 /testcases/3-1596154591sr
 
 
3. If the problem still persists, please recreate the UTL_FILE packages.  This exercise is to make sure that the package itself is flawless.  Sometimes such error occurs if the packages are incomplete. 
 
You would need to run the following scripts: 
 
utlfile.sql (UTL_FILE package header) 
prvtfile.plb (UTL_FILE package body) 
 
Scripts can be found in the $ORACLE_HOME/rdbms/admin directory. 
 
 
SQL> @?/rdbms/admin/utlfile.sql
 
Package created.
Grant succeeded.
Synonym created.
 
SQL> @?/rdbms/admin/prvtfile.plb
Library created.
Package body created.
No errors. 
 
 
Check validity and time of the package: 
 
 
SQL> select OWNER, OBJECT_NAME, OBJECT_TYPE, LAST_DDL_TIME, STATUS from DBA_OBJECTS where OBJECT_NAME like 'UTL_FILE';
 
 
 
Internal documented behavior - Bug 5260543 (Not a bug):
 
Oracle 10g has some improvements over Oracle 9i and does not invalidate objects unnecessarily.
 
Last_ddl_time is found to be changed under the following conditions:
 
i) When the source of the procedure changes.
(or)
ii) The settings of following parameters change from original creation time: plsql_optimize_level, plsql_code_type, plsql_debug, nls_length_semantics, plsql_warnings, plsql_ccflags, plsql_compiler_flags.
 
This is an expected behaviour and not a bug
 
In any case, if you issue an explicit "ALTER PACKAGE UTL_FILE COMPILE;" the timestamp will change.
 
4. File that is being read or written is really important.  If the file format is incorrect then UTL_FILE cannot read or write to it.  UTL_FILE using R mode can only read ASCII files with valid line terminators.  The file is opened with no size parameter in mode R meaning it is opened as an ASCII format rather than binary file.  Therefore the line size limit is still 1024. If there is a line longer than this it will fail with 'file read error'.  In those cases, adding line size parameter to FOPEN call will help.  ASCII files are read into a buffer until a new line is retrieved and the default buffer size is 1024.  If the file is being read as binary then opening it as binary means new lines are no longer relevant.  If the file is in BINARY format then using UTL_FILE.GET_RAW with RB mode will help.  Reference Oracle MySupport Article <>
 
For Customers, using Oracle Applications products.  Any settings at APPS/FND level (ATG/EBS 11i or 12.0.x) are supported by that Product group - 510 Oracle Application Object Library, Component: CONCURRENT PROCESSING (CP), Subcomponent: CCREQ.  And ATG - APPS EBS group may check on the setup of APPLPTMP/FND_FILE using the UTL_FILE.   This article is only a general recommendation.  A separate Service Request (SR) needs to be created with that group.  

转 UTL_FILE Throws ORA-29284 Or ORA-29283 When Attempting To READ File的更多相关文章

  1. 真心崩溃了,oracle安装完成后居然没有tnsnames.ora和listener.ora文件

    problem: oracle  11  r2  64位安装完成后NETWORK/ADMIN目录下居然没有tnsnames.ora和listener.ora文件 solution: 问题是之前安装了另 ...

  2. oracle中的listener.ora和tnsnames.ora

    一.oracle的客户端与服务器端 oracle在安装完成后服务器和客户端都需要进行网络配置才能实现网络连接.    服务器端配置监听器,客户端配置网络服务名. 服务器端可配置一个或多个监听程序 . ...

  3. oracle错误(ORA:12154 ORA:01034 和 ORA:27101 ORA-18008 ORA-01081)

    按照正常操作流程,启动项目,发现项目报错,原因是连接不上oracle数据库, PLSQL连接时报错,错误码  ORA:12154 无法解析指定的连接标识符 第一次,遇到这个错误,在网上找了资料都是需要 ...

  4. 记录一份Oracle 正确的监听配置文件listener.ora与tnsnames.ora

    一.前言 昨天中午接到领导指示,有其他组的负责人B在厄瓜多尔演示他们组的产品,然后我们组的负责人就想说也在那边搭一套环境,(北美那边的亚马逊云环境),让B帮忙演示下我们的系统. 于是,开始了一个比较曲 ...

  5. PLSQL连接ORACLE配置字符串简介 oracle网络配置 三个配置文件 listener.ora、sqlnet.ora、tnsnames.ora原理解释

    PLSQL连接ORACLE配置字符串简介 oracle网络配置 三个配置文件 listener.ora.sqlnet.ora.tnsnames.ora原理解释 oracle网络配置三个配置文件 lis ...

  6. oracle: listener.ora 、sqlnet.ora 、tnsnames.ora的配置及例子

    1.解决问题:TNS或者数据库不能登录.      最简单有效方法:使用oracle系统提供的工具 netca 配置(把原来的删除掉重新配置)     $netca  2.然而,仍有疑问:如何指定'l ...

  7. oracle手动修改listener.ora和tnsnames.ora之后竟然无效

    oracle手动修改listener.ora和tnsnames.ora之后竟然无效 花式重启都没有生效,需要使用Net Configuration Assistant来进行刷一下,重新生成的监听还是一 ...

  8. 安装好oracle11gR2之后在相应路径下却没有生成tnsnames.ora和listener.ora

    oracle安装帖子:https://blog.csdn.net/wjb123sw99/article/details/80780277 oracle安装过程中检查失败:需开启C盘共享,或者勾选忽略, ...

  9. oracle三个网络配置文件(listener.ora、tnsname.ora、sqlnet.ora)的作用

    oracle网络配置 三个配置文件 listener.ora.sqlnet.ora.tnsnames.ora ,都是放在$ORACLE_HOME\network\admin目录下. 1.  sqlne ...

  10. oracle三个连接配置文件 listener.ora、sqlnet.ora、tnsnames.ora

    关于PLSQL连接ORACLE配置字符串 首先要讲一下下面的一些知识 1.ORACLE_SID:(ORACLE SYSTEM IDENTIFIER) Oracle实例是由SGA和一组后台进程组成的,实 ...

随机推荐

  1. oracle数据库登录

    在做以下操作时,要确保你的数据库环境已经正确安装完成.数据库在实际应用中是比较多的,我们测试人员经常会在前台造一些测试数据,在后台数据库进行验证,当然,不局限于此,数据库也可以作为一个专项测试来谈.反 ...

  2. phpmyadmin安全预防

    头疼的安全 之前服务器总是本人黑,千疮百孔,只能一步步的去做一些安全防范,如何防范自然先从如何渗透开始. 文章及建议 前段时间看到了个phpmyadmin提权的教程,很多人都说现在那里还有root帐号 ...

  3. 编写高质量代码改善C#程序的157个建议——建议39:了解委托的实质

    建议39:了解委托的实质 理解C#中的委托需要把握两个要点: 1)委托是方法指针. 2)委托是一个类,当对其进行实例化的时候,要将引用方法作为它的构造方法的参数. 设想这样一个场景:在点对点文件传输过 ...

  4. 设计模式04: Factory Methord 工厂方法模式(创建型模式)

    Factory Methord 工厂方法模式(创建型模式) 从耦合关系谈起耦合关系直接决定着软件面对变化时的行为 -模块与模块之间的紧耦合使得软件面对变化时,相关的模块都要随之变更 -模块与模块之间的 ...

  5. 安装vmtools Error: Unable to execute "/usr/bin/vmware-uninstall-tools.pl.

    Error: Unable to execute "/usr/bin/vmware-uninstall-tools.pl. 安装vmware tools错误解决办法 很多朋友都在用vmwar ...

  6. 快速入手Web幻灯片制作

    在线幻灯片 使用markdown可以快速的写出优美的文档,接下来我介绍一些简单的语法,快速的用浏览器制作幻灯片. 最基本使用格式 <!DOCTYPE html> <html> ...

  7. 再解炸弹人——BFS

    原创 之前用了枚举法解炸弹人,题目详情请看我之前的博客:https://www.cnblogs.com/chiweiming/p/9295262.html 利用枚举法是无视地图布局的,枚举法直接全局搜 ...

  8. EasyUI combobox实现下拉框多选遇坑记录

    场景一: 多选正常从第二个选项增加逗号,我选第一个的时候就冒出一个逗号 解决方案一: 这是因为当前的下拉框的值可能为undefined,需要手动清空一下 $("#id").comb ...

  9. 关于hibernate的查询

    为什么建议hibernate查询全部字段 一般而言,要查询什么字段就查询什么字段,不要select * from表,但是在hibernate,我们其实可以不遵循这个规则,建议我们把所有属性都查询出来( ...

  10. switch case 判断是否为按钮、设置属性 Load Foreach 绑定事件

    private void button9_Click(object sender, EventArgs e) { foreach (Control CT in this.Controls) {//判断 ...