首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >plsql CSV文件读写

plsql CSV文件读写
EN

Stack Overflow用户
提问于 2017-04-06 15:07:35
回答 2查看 605关注 0票数 0
代码语言:javascript
复制
OWNER   SYS
DIRECTORY_NAME  ME
DIRECTORY_PATH  \\172.16.20.11\Mad\


begin

vSFile := utl_file.fopen('ME','20170405.csv','R');
IF utl_file.is_open(vSFile) THEN
LOOP

我收到错误消息:

代码语言:javascript
复制
ORA-29283: invalid file operation ORA-06512: at "SYS.UTL_FILE", line 536 ORA-29283: invalid file operation ORA-06512: at "MADHUR.MSP_UPD_DAILYSALESFRMSAP", line 28 ORA-06512: at line 1
29283. 00000 -  "invalid file operation"
*Cause:    An attempt was made to read from a file or directory that does
           not exist, or file or directory access was denied by the
           operating system.
*Action:   Verify file and directory access privileges on the file system,
           and if reading, verify that the file exists.
EN

回答 2

Stack Overflow用户

发布于 2017-04-06 16:10:43

出现此问题的原因是您没有对directoryreadwrite权限。

运行以下查询,查看您是否具有readwrite权限:

代码语言:javascript
复制
 SELECT * 
      FROM all_tab_privs 
     WHERE table_name = 'your_directory name';      

如果您发现没有任何访问权限,则授予读取和写入权限。

代码语言:javascript
复制
SQL>CREATE OR REPLACE DIRECTORY dir1 as '/opt/oracle/';

SQL>GRANT READ,WRITE on dir1 to <Required user>; (if you want to give access to particular user)
OR
SQL>GRANT READ,WRITE on dir1 to PUBLIC; (if you want to give access to all users then give access to public)
票数 0
EN

Stack Overflow用户

发布于 2017-04-06 16:12:24

您的错误准确地告诉您问题是什么:

*Cause: An attempt was made to read from a file or directory that does not exist, or file or directory access was denied by the operating system.

以及如何修复它:

*Action: Verify file and directory access privileges on the file system, and if reading, verify that the file exists.

因此,您可以指定:

DIRECTORY_PATH \\172.16.20.11\Mad\

您是否能够通过您的oracle用户实际访问\\172.16.20.11\Mad\

如果没有,那么您需要grant read, write on directory to user并检查您的用户对该路径的OS权限。

但也考虑做一个网络共享驱动器号,而不是UNC路径。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43248066

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档