My Oracle Support Banner

Attempting to Open a File on the File System Using UTL_FILE Fails With: FILE_OPEN, ACCESS_DENIED or ORA-29289: directory access denied (Doc ID 1600614.1)

Last updated on JANUARY 01, 2024

Applies to:

PL/SQL - Version 9.2.0.8 and later
Information in this document applies to any platform.

Symptoms

Attempting to open a file on the file system using UTL_FILE Fails with: FILE_OPEN, ACCESS_DENIED or ORA-29289: directory access denied

For Example:

CREATE OR REPLACE PROCEDURE TEST_FILE_OPEN IS

           file_handle UTL_FILE.FILE_TYPE; -- file handle of OS flat file
          
         BEGIN
           -- Open file to write into  and get it's file_handle
           file_handle :=
             UTL_FILE.FOPEN('FILESDIR','myfile.txt','W');

           -- Write a line of text out to the file.
           UTL_FILE.PUT_LINE(file_handle, 'This is test data');

 
           -- Close the file.
           UTL_FILE.FCLOSE(file_handle);

        END;      
/

SQL> exec test_file_open
BEGIN test_file_open; END;

*
ERROR at line 1:
ORA-29289: directory access denied
ORA-06512: at "SYS.UTL_FILE", line 41
ORA-06512: at "SYS.UTL_FILE", line 478
ORA-06512: at "SCOTT.TEST_FILE_OPEN", line 7
ORA-06512: at line 1

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.