다음은 테이블에서 플랫 파일로 데이터를 추출하는 데 사용하는 코드입니다.ORA-29283 : 파일 조작이 올바르지 않습니다. ORA-06512 : "SYS.UTL_FILE"행의 536
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;
이 코드는 개발 데이터베이스에서 정상적으로 작동하지만 새로운 DB에서 실행하면 아래 오류가 발생합니다.
Oracle directory 'SEND' points to some UNIX directory which has rights as
'rwxrwsr-x' (Octal 2775)
Oracle Version:11g
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.
나를이 문제를 해결하는 데 도움이 바랍니다.
이 질문을 해결하기 위해 더 많은 데이터가 필요하면 알려주십시오.
은 (는) 새 DB에서 SEND 디렉토리가 생성 되었습니까? 새 DB에있는 DB 사용자는 DB-DIRECTORY 오브젝트에 대해 READ 및 WRITE 권한을 가지고 있습니까? – schurik
'SEND'에 대한 명시 적 경로를 사용해 보셨습니까? 누가 폴더를 소유합니까? 사용 권한을 rwxrwsrwx로 변경하면 작동합니까? – forsvarir
@schurik : 예, 디렉토리가 새 DB에 있으며 oracle 디렉토리에 READ 및 WRITE 권한이 있습니다. @forsvairr : SEND 대신 명시 적 경로를 사용할 수 있습니까? 그러면 어떻게 할 수 있니? 나는 오라클 디렉토리가 경로를 지정하는 유일한 방법이라고 생각했습니다. 디렉토리의 권한을 변경할 수 없으며 액세스 할 수 없습니다. 이 폴더는 'build'가 소유하고 있으며 사용자 'batch'는이 폴더에 파일을 생성합니다. 두 사용자 모두 '빌드'와 '배치'가 같은 그룹 – Vivek