Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question.

Asked: April 10, 2017 - 1:00 pm UTC

Last updated: April 12, 2017 - 1:36 am UTC

Version: 11

Viewed 10K+ times! This question is

You Asked

I have a mounted directory as follow:

<i>etc/fstab</i>

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

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

 these instead are the priv (GRANTEE,TABLE_NAME,PRIVILEGE)

    PUBLIC FTP_IN READ

    PUBLIC FTP_IN WRITE

    DB_SCHEMA FTP_OUT READ

    DB_SCHEMA FTP_OUT WRITE

I execute this to move the files

    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


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

Thanks

and Connor said...

The most common reason for this is that "frename" is as the name suggests strictly a rename, not a move. So if you are trying to "rename" a file *across* file systems, then it is unlikely this will work.

eg

renaming from /u01/dir1/file1 to /u01/dir2/file2 would work (if '/u01' is the mounted file system).

but

renaming from /u01/dir1/file1 to /u02/dir1/file1 would not work (if '/u01' and '/u02' are different file system2).

Rating

  (3 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, April 11, 2017 - 7:44 am UTC

https://stackoverflow.com/questions/43323652/utl-file-rename-operation-failed

I've put here some new updates..
So If I need to move actually the file I have to use some bash commands, like mv?
Connor McDonald
April 12, 2017 - 1:36 am UTC

You can do it in 2 steps

utl_file.fcopy
utl_file.fremove




A reader, April 11, 2017 - 7:50 am UTC

Hi,

Thank for answering

Check here,
https://stackoverflow.com/questions/43323652/utl-file-rename-operation-failed
I've add more details

So, If I need to move the files across 2 different system, like between the mounted directory and 'normal' os, how could I do that? Do I need to use set-up bash scripting?

A reader, March 08, 2019 - 9:32 am UTC


More to Explore

ASM

Need more information on ASM? Check out the ASM guide for the Oracle Database