Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote a flakey PL/SQL script that crashed out and forgot to close the file handle (type UTL_FILE.file_type).

Now I can't delete the file. Short of restarting the instance or rebooting the box, is there anything I can run within Oracle to clear the handle? I've system user access to the box in question.

Update: Oracle is running on Windows.

share|improve this question
Which OS are you on? I'm guessing Windows, as filesystems on Unix-like OSes generally let you delete a file even if opened by another process. – Colin 't Hart Jan 23 '14 at 13:05
if you know which session has oened the file you could kill this session. At least on Linux this would work. – miracle173 Mar 26 '14 at 3:36
@Colin 't Hart : in Unix you can delete a directory entry while it is open but cannot delete the file until the last file handle is closed. So you have a similar problem. – miracle173 Mar 26 '14 at 3:41
Similar thing happened to me just the other day. You should just be able to close the process that opened the connection (and hence the file) and all should be good. Mine was through SQLDeveloper; I disconnected the session and was then able to delete the file. – BriteSponge Mar 9 at 13:19

If you just want to forcefully close the file, you could use a tool which lets you close open files.

Googling I found OpenFilesView. See

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.