2017-04-10 137 views
0

我有一個安裝目錄如下:UTL文件重命名操作失敗

etc/fstab

10.100.52.12:/ftp /ftp nfs rw,bg,hard,nointr,rsize=1048576,wsize=1048576,tcp,vers=3,timeo=60,actimeo=0 0 0

# ll

drwxr-xr-x 6 root  1000  62 Mar 29 13:48 ftp 

所以我必須從這個目錄中「移動」的文件的目錄裏面ACFS

drwxrwxrwx 6 oracle oinstall 4096 Apr 10 09:34 ftp_files 

這些替代是

(GRANTEE,TABLE_NAME,PRIVILEGE) 
PUBLIC FTP_IN READ 
PUBLIC FTP_IN WRITE 
DB_SCHEMA FTP_OUT READ 
DB_SCHEMA FTP_OUT WRITE 

我執行這個移動文件的私法

declare 
SRC  CONSTANT VARCHAR2(50) := 'FTP_IN'; 
DST  CONSTANT VARCHAR2(50) := 'FTP_OUT'; 

begin 
    UTL_FILE.FRENAME(
     src_location => SRC, 
     src_filename => 'test.txt', 
     dest_location => DST, 
     dest_filename => 'test.txt', 
     overwrite => FALSE); 
end; 

但它不起作用,我得到

ORA-29292: file rename operation failed 
ORA-06512: a "SYS.UTL_FILE", line 348 
ORA-06512: a "SYS.UTL_FILE", line 1290 
ORA-06512: a line 6 
29292. 00000 - "file rename operation failed" 
*Cause: A file rename attempt was refused by the operating system 
      either because the source or destination directory does not 
      exist or is inaccessible, or the source file isn't accessible, 
      or the destination file exists. 
*Action: Verify that the source file, source directory, and destination 
      directory exist and are accessible, and that the destination 
      file does not already exist. 

-rw-r--r-- 1 oracle oinstall 0 Apr 10 14:47 test.txt 

但是,如果我只是試圖刪除該文件而不是frename它,它的工作原理。 那麼這可能是什麼?

這裏是從DBA_DIRECTORIES輸出:

SYS FTP_IN /sftp 
SYS FTP_OUT /acfs/external/ftp_files 


CREATE DIRECTORY FTP_IN as '/ftp'; 
GRANT READ, WRITE ON DIRECTORY FTP_IN TO DB_SCHEMA; 
GRANT EXECUTE, READ, WRITE ON DIRECTORY FTP_IN TO SYSTEM WITH GRANT OPTION; 

由於

TESTING UTL_FILE.FOPEN(SRC)

declare 
SRC  CONSTANT VARCHAR2(50) := 'FTP_IN'; 
DST  CONSTANT VARCHAR2(50) := 'FTP_OUT'; 
l_file  UTL_FILE.FILE_TYPE; 

begin 

    l_file:=utl_file.fopen(SRC,'test.txt','W'); 
    UTL_FILE.PUT_LINE(l_file, CONVERT('test', 'AL32UTF8')); 
    UTL_FILE.FCLOSE(l_file); 

end; 

-rw-r--r-- 1 oracle oinstall 5 Apr 10 15:21 test.txt 

TESTING UTL_FILE.FOPEN(DST)

declare 
SRC  CONSTANT VARCHAR2(50) := 'FTP_IN'; 
DST  CONSTANT VARCHAR2(50) := 'FTP_OUT'; 
l_file  UTL_FILE.FILE_TYPE; 

begin 

    l_file:=utl_file.fopen(DST,'test.txt','W'); 
    UTL_FILE.PUT_LINE(l_file, CONVERT('test', 'AL32UTF8')); 
    UTL_FILE.FCLOSE(l_file); 

end; 

-rw-r--r-- 1 oracle oinstall 5 Apr 10 15:29 test.txt 
[[email protected] ftp_files]$ pwd 
/acfs/external/ftp_files 
[[email protected] ftp_files]$ 

https://asktom.oracle.com/pls/apex/f?p=100:12:0::NO::P12_ORIG,P12_PREV_PAGE,P12_QUESTION_ID:Y,1,9534424300346182278

+0

您是如何申報您的展位的?'DIRECTORY_NAME'喜歡'FTP%''的DBA_DIRECTORIES中的SELECT *的結果是什麼? –

+0

請修改您的問題以包含其他信息。留下評論意見。 – APC

回答

0

「如果我只是嘗試刪除該文件,而不是frename它,它的工作原理。所以說這個問題呢?」

因此,操作系統源目錄存在,並且oracle操作系統帳戶擁有寫入權限。

frename失敗表明,無論是:

  • 操作系統目標目錄不存在,或
  • oracle OS帳戶沒有在其上寫權限,或
  • 數據庫目錄對象已被錯誤地定義,或者
  • OS目標目錄已經包含該名稱的文件。
+0

如果我以oracle用戶身份登錄,我可以通過bash運行mv。無論如何,運行覆蓋爲真的frename,不會改變任何東西 –