utl 文件重命名操作失败 [英] utl file rename operation failed

查看:42
本文介绍了utl 文件重命名操作失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个挂载目录如下:

I have a mounted directory as follow:

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 内的一个目录

So I have to 'move' a file from this directory to a directory inside 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;

但它不起作用,我明白了

but it doesn't work, I get

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 它,它就可以工作.那么这可能是什么?

But if I just try to delete the file instead of frename it, it works. So what this could be?

以下是 DBA_DIRECTORIES 的输出:

Here is the output from 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;

谢谢

测试 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

测试 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
[oracle@db01 ftp_files]$ pwd
/acfs/external/ftp_files
[oracle@db01 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>

推荐答案

如果我只是尝试删除文件而不是对其进行 frename,它会起作用..这可能是什么?"

"If i just try to delete the file instead of frename it, it works.. So what this could be?"

因此操作系统源目录存在并且oracle操作系统帐户对其具有写入权限.

So the OS source directory exists and the oracle OS account has write privileges on it.

但是 frename 失败表明:

  • 操作系统目标目录不存在,或者
  • oracle 操作系统帐户没有写入权限,或者
  • 数据库 DIRECTORY 对象定义不正确,或者
  • 操作系统目标目录已包含该名称的文件.
  • the OS target directory does not exist, or
  • the oracle OS account does not have write privileges on it, or
  • the database DIRECTORY object has been defined incorrectly, or
  • the OS target directory already contains a file of that name.

这篇关于utl 文件重命名操作失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆