Skip to Main Content
  • Questions
  • UTL_FILE write and User permission in Unix directory

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Muthukumaran.

Asked: March 27, 2020 - 10:44 am UTC

Last updated: March 30, 2020 - 1:16 am UTC

Version: Oracle 12c

Viewed 1000+ times

You Asked

I am using UTL_FILE.FOPEN('Unix_Directory_path','FileName.txt','w') in my Pl/Sql package and the file is getting written successfully but the User and permission are different than the file generated using SPOOL, both are using the same batch file in UNIX

-rw-r----- 1 explora exploit 15975 Mar 27 17:32 SPOOL_Test_20200229.txt_bk
-rw-r--r-- 1 oracle exploit 15975 Mar 27 18:26 UTL_FILE_Test_20200229.txt

The first file which is created with explora USER but the UTL_FILE creates the file using Oracle USER, Is there any way to create the file with explora USER ?

and Connor said...

Sorry no, because UTL_FILE is running *as* the oracle user.

You could consider using 'umask' to make the group read/write ...but anything that relaxes security permissions must always be treated with care.

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

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library