Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: inner workings of UTL_FILE.RENAME??

Re: inner workings of UTL_FILE.RENAME??

From: Runs with Scissors <tgb_at_REMOVEsoftitect.com>
Date: Fri, 22 Oct 2004 21:07:34 GMT
Message-ID: <qEeed.18539$hN1.1880@twister.socal.rr.com>

"underthegun" <rpc35803_at_msn.com> wrote in message news:f7acfcc9b94c5aed21f01bd2cd404e4d_at_localhost.talkaboutdatabases.com...
> We are using the UTL_FILE.RENAME function to give created files good names
> after they are complete (we use temporary names at creation time and use
> that name while still writing the file). Can anyone tell me the logic
> that Oracle uses to perform these file renames on the UNIX system? We
> occasionally run into trouble when another piece of software, looking for
> completed files (ignores files with "TEMP" in the front of the file name),
> tries to pick up one of the files that is being renamed from it's
> TEMP_<filename> to <filename>.
>

First, I don't know how UTL_FILE.RENAME works. I have experienced similar problems when renaming files using other mechanisms.

What sort of trouble are you having? At risk of being annihilated for making an assumption in a newsgroup, I'm going to venture a guess that the second program is picking up the new file before UTL_FILE.RENAME has completed. If this is the case, you may be running into the case where the rename is spanning file systems. In most flavors of *nix you can't mv a file between filesystems directly, there has to be a call to cp (cpio). In the case of a mv within a filesystem, only the inode is changed. A mv across filesystems is actually a cp (cpio).

If the following are true:

  1. You are renaming across filesystems
  2. You are picking up the file before UTL_FILE.RENAME has completed

You could try renaming the file in two steps:

  1. Keeping the original filename, UTL_FILE.RENAME it to the other filesystem. This way the second program will ignore it.
  2. UTL_FILE.RENAME it again to give it the new filename (which if UTL_FILE.RENAME uses the underlying Unix to do the rename, should only touch the inode.)

Hope that helps.

Tom Received on Fri Oct 22 2004 - 16:07:34 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US