问题描述
嗨,汤姆,
感谢您与我们在一起,并感谢您多年来的支持。
从最近几天开始,我在从应用程序中写入文件时遇到错误,即
异常信息: ORA-29283: 无效的文件操作。
但是,如果我从SQL developer运行相同的过程,它可以正常工作。
并且此错误与特定过程无关。任何程序都可能出现这种情况。
假设我的应用程序调用50个过程将数据一个一个地写入文件,不能确定当这个错误会来的时候,它可能会在调用50个过程时出现。
以前,所有东西都运行良好,没有授予和操作系统级别权限的问题,
我已经交叉检查,并且Sql developer的过程运行良好。
我还尝试在调用过程之间将过程延迟5秒钟,但仍然会出现错误。
请提出一些建议。
感谢您与我们在一起,并感谢您多年来的支持。
从最近几天开始,我在从应用程序中写入文件时遇到错误,即
异常信息: ORA-29283: 无效的文件操作。
但是,如果我从SQL developer运行相同的过程,它可以正常工作。
并且此错误与特定过程无关。任何程序都可能出现这种情况。
假设我的应用程序调用50个过程将数据一个一个地写入文件,不能确定当这个错误会来的时候,它可能会在调用50个过程时出现。
以前,所有东西都运行良好,没有授予和操作系统级别权限的问题,
我已经交叉检查,并且Sql developer的过程运行良好。
我还尝试在调用过程之间将过程延迟5秒钟,但仍然会出现错误。
请提出一些建议。
专家解答
你得到这个是因为数据库由于某种原因无法访问文件。通常是因为文件权限。
但是,如果这是间歇性发生的,则表明您的进程正在破坏彼此的文件访问。例如,一个会话在另一个会话尝试访问它之前删除该文件。
为了提供更有意义的帮助,我们需要查看您的代码!与你如何调用这个得到一个错误的描述。
为了进一步阅读,MOS note 746882.1讨论了ORA-29283的各种原因和解决方案:
Goal
This article will explain you the general scenario when ORA-29283 (INVALID FILE OPERATION) can be thrown from UTL_FILE package while accessing operating system file and how to debug the exception
Solution
The error can be raised because of the following causes.
General causes and solutions of ORA-29283 error:
1. Check whether the schema where the PLSQL code is run has READ,WRITE permission on the database directory.
If SCOTT is the schema , then login as SYS grant required permission.
GRANT READ,WRITE ON DIRECTORY TO SCOTT
2. Check whether the path used in database directory physically exists on the OS.
Eg :
CREATE OR REPLACE DIRECTORY DIRNAME as '/home/test';
/home/test should exist on the OS. When the database directory is created , oracle doesnt check the validity of the directory path used. The validation of the path is done at the runtime. Hence it is necessary to check the file path on OS before the program is executed.
3. Check whether the owner of oracle process has enough permission on the OS directory where the file is accessed.
]$ ls -l /u01/app/oracle/product/10.2/db_1/bin/oracle
-rwsr-s--x 1 oracle oinstall 96725778 Jul 7 2008 /u01/app/oracle/product/10.2/db_1/bin/oracle
"oracle" is the owner of the oracle executable. oracle - user should have enough permission on the directory.
]$ su oracle
Password:
]$ whoami
oracle
]$touch /home/test/abc.txt
You should be able to create a file using touch command login as the owner of the oracle process.
4. Make sure you have restarted the listener once you have done any OS level changes to the directories accessed by RDBMS.
Once you have done any changes in OS level permission, you should always restart the listener so that it inherits the recently changed permission.
Else oracle will sometime raise a ora-29283 error.
5. Even though oracle-user has enough permissions on the directory, it may raise ora-29283 if the owner of the file is not oracle.
If the file is created with the rw-r-- permission and owned by another user, RDBMS wont be able to read the file. In such case you will have to change the permissions of the file to rw-rw--
chmod 750
6. Using remote directories :
UTL_FILE package can access only server side files where the database instance is running. You cannot access client side files. If you are using UNIX system, then create a NFS mount of the client folder on the server . If on Windows platform then go through
Note 45172.1 : Running UTL_FILE on Windows NT
Note 1034188.6: INVALID_OPERATION Exception from UTL_FILE when Writing to/from Network Drive
Solution:
Start the Oracle service as a user who has the same permissions as SYSTEM, and also who has access to the shared directory.
7. Check ORA_NLS on application server :
If the ORA_NLSXX where XX is 32, 33 or 10 is set, it must be set before starting the database and on the client side too.
Note 77442.1 : ORA_NLS (ORA_NLS32, ORA_NLS33, ORA_NLS10) Environment Variables explained
但是,如果这是间歇性发生的,则表明您的进程正在破坏彼此的文件访问。例如,一个会话在另一个会话尝试访问它之前删除该文件。
为了提供更有意义的帮助,我们需要查看您的代码!与你如何调用这个得到一个错误的描述。
为了进一步阅读,MOS note 746882.1讨论了ORA-29283的各种原因和解决方案:
Goal
This article will explain you the general scenario when ORA-29283 (INVALID FILE OPERATION) can be thrown from UTL_FILE package while accessing operating system file and how to debug the exception
Solution
The error can be raised because of the following causes.
General causes and solutions of ORA-29283 error:
1. Check whether the schema where the PLSQL code is run has READ,WRITE permission on the database directory.
If SCOTT is the schema , then login as SYS grant required permission.
GRANT READ,WRITE ON DIRECTORY
2. Check whether the path used in database directory physically exists on the OS.
Eg :
CREATE OR REPLACE DIRECTORY DIRNAME as '/home/test';
/home/test should exist on the OS. When the database directory is created , oracle doesnt check the validity of the directory path used. The validation of the path is done at the runtime. Hence it is necessary to check the file path on OS before the program is executed.
3. Check whether the owner of oracle process has enough permission on the OS directory where the file is accessed.
]$ ls -l /u01/app/oracle/product/10.2/db_1/bin/oracle
-rwsr-s--x 1 oracle oinstall 96725778 Jul 7 2008 /u01/app/oracle/product/10.2/db_1/bin/oracle
"oracle" is the owner of the oracle executable. oracle - user should have enough permission on the directory.
]$ su oracle
Password:
]$ whoami
oracle
]$touch /home/test/abc.txt
You should be able to create a file using touch command login as the owner of the oracle process.
4. Make sure you have restarted the listener once you have done any OS level changes to the directories accessed by RDBMS.
Once you have done any changes in OS level permission, you should always restart the listener so that it inherits the recently changed permission.
Else oracle will sometime raise a ora-29283 error.
5. Even though oracle-user has enough permissions on the directory, it may raise ora-29283 if the owner of the file is not oracle.
If the file is created with the rw-r-- permission and owned by another user, RDBMS wont be able to read the file. In such case you will have to change the permissions of the file to rw-rw--
chmod 750
6. Using remote directories :
UTL_FILE package can access only server side files where the database instance is running. You cannot access client side files. If you are using UNIX system, then create a NFS mount of the client folder on the server . If on Windows platform then go through
Note 45172.1 : Running UTL_FILE on Windows NT
Note 1034188.6: INVALID_OPERATION Exception from UTL_FILE when Writing to/from Network Drive
Solution:
Start the Oracle service as a user who has the same permissions as SYSTEM, and also who has access to the shared directory.
7. Check ORA_NLS on application server :
If the ORA_NLSXX where XX is 32, 33 or 10 is set, it must be set before starting the database and on the client side too.
Note 77442.1 : ORA_NLS (ORA_NLS32, ORA_NLS33, ORA_NLS10) Environment Variables explained
文章转载自ASKTOM,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
【专家有话说第五期】在不同年龄段,DBA应该怎样规划自己的职业发展?
墨天轮编辑部
1155次阅读
2025-03-13 11:40:53
Oracle RAC ASM 磁盘组满了,无法扩容怎么在线处理?
Lucifer三思而后行
704次阅读
2025-03-17 11:33:53
Oracle+Deepseek+Dify 实现数据库数据实时分析
bicewow
619次阅读
2025-03-06 09:41:49
【ORACLE】ORACLE19C在19.13版本前的一个严重BUG-24761824
DarkAthena
516次阅读
2025-03-04 14:33:31
Oracle避坑指南|同名表导出难题:如何精准排除指定用户下的表?
szrsu
491次阅读
2025-03-05 00:42:34
Ogg23ai高手必看-MySQL Innodb Cluster跟oracle的亲密接触
曹海峰
426次阅读
2025-03-04 21:56:13
2月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
411次阅读
2025-03-13 14:38:19
【ORACLE】char类型和sql优化器发生的“错误”反应
DarkAthena
390次阅读
2025-03-04 23:05:01
什么,oracle 主机用户被删了?原来是虚惊一场!
Lucifer三思而后行
374次阅读
2025-03-03 21:12:09
Oracle RAC 数据文件添加成本存储的解决办法
ByteHouse
319次阅读
2025-02-26 16:40:50
热门文章
Oracle Json-pl/SQL ORA-30625: 不允许空自参数上的方法调度
2020-11-11 4957浏览
Oracle ORA-22835: 缓冲区太小,无法CHAR或BLOB转换为RAW (实际: 6843,最大值: 2000)
2019-04-10 4609浏览
Oracle SQL * Loader-350: 当子句语法失败时语法错误
2021-03-19 4246浏览
Oracle 将all_tables连接到普通表
2019-02-08 4126浏览
Oracle ORA-29279: SMTP永久错误: 执行邮件过程时未实现502命令
2019-03-06 3769浏览