oracle - ORA-29283 : invalid file operation ORA-06512: at "SYS.UTL_FILE", 行 536

标签 oracle plsql oracle11g ora-06512

下面是我用来将数据从表中提取到平面文件的代码。

BEGIN
    DECLARE
        file_name VARCHAR2(50);
        file_handle utl_file.file_type;
BEGIN
    file_name := 'table.txt';
    file_handle := utl_file.fopen('SEND',file_name,'W');
FOR rec in(
    SELECT            column 1
                ||'~'||column 2
                ||'~'||column 3 out_line
    FROM table1)LOOP
UTL_FILE.PUT_LINE(file_handle,rec.out_line);
UTL_FILE.FFLUSH(file_handle);
END LOOP;
UTL_FILE.FCLOSE(file_handle);
END;
end;

此代码在我们的开发数据库中运行良好,但如果我在新数据库中执行,则会抛出以下错误。

Error starting at line 1 in command:
    BEGIN
    DECLARE
        file_name VARCHAR2(50);
        file_handle utl_file.file_type;
BEGIN
    file_name := 'table.txt';
    file_handle := utl_file.fopen('SEND',file_name,'W');
FOR rec in(
    SELECT            column 1
                ||'~'||column 2
                ||'~'||column 3 out_line
    FROM table1)LOOP
UTL_FILE.PUT_LINE(file_handle,rec.out_line);
UTL_FILE.FFLUSH(file_handle);
END LOOP;
UTL_FILE.FCLOSE(file_handle);
END;
end;

Error report:
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
ORA-06512: at line 7
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.
<小时/>
Oracle directory 'SEND' points to some UNIX directory which has rights as 
       'rwxrwsr-x' (Octal 2775)
Oracle Version:11g

请帮我解决这个问题。

如果您需要我提供更多数据来解决这个问题,请告诉我。

最佳答案

所以,@Vivek 通过评论中的对话而不是通过实际的答案找到了问题的解决方案。

"The file is being created by user oracle just noticed this in our development database. i'm getting this error because, the directory where i try to create the file doesn't have write access for others and user oracle comes under others category. "

由于这个问题没有公认的答案,我提供了一个指向我关于 UTL_FILE.FOPEN() 主题的答案的链接。 Find it here .

附注我将此答案标记为社区 Wiki,因为它不是此问题的正确答案,只是重定向到其他地方。

关于oracle - ORA-29283 : invalid file operation ORA-06512: at "SYS.UTL_FILE", 行 536,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6014884/

相关文章:

java - 使用maven导出数据库Oracle

database - 具有不同 SID 的 Oracle 导出数据库

c# - Oracle 连接请求超时

database - 如何检查类型的依赖项以删除它们并替换/修改初始类型?

sql - 计算来自两个不同表的两行之间的差异

java - Hibernate删除和更新

sql - 在 Oracle 中的 BEFORE INSERT TRIGGER 中何时不需要 FOR EACH ROW?

sql - PL/SQL 分组依据 - ORA-01422 : exact fetch returns more than requested number of rows

Oracle DBMS_SCHEDULER 系统日期参数

oracle - 戈朗oci8 : error adding symbols: File in wrong format