Wrong owner when executing oracle pl/sql FOPEN?

Hello,

I have a user that is executing some pl/sql. He opoens a file with UTL_FILE.FOPEN and then writes some things and closes the file. BUT the file is owned by unix user "oracle" with a group of "dba" ??!! He is running as user "mwallace" (both in unix and oracle sqlplus) ? When he tries to edit the file, he gets permission denied... Please help!

btw...If the user spools output it will go to a file which he owns.

Thanks!
Keith
keithedwardAsked:
Who is Participating?
 
syakobsonConnect With a Mentor Commented:
UTL_FILE package ALWAYS creates a file owned by oracle rather than package caller. I'll explain why. PL/SQL (and UTL_FILE is PL/SQL package) is executed on the SERVER side rather than CLIENT side. Client can be on a different box, using different OS, etc... and in general does not need to exist as OS user on DB server side. You need to write an external stored procedure that would take two parameters: file and new owner and would execute corresponding chown (Unix change owner command).

Solomon Yakobson.
0
 
mshaikhCommented:
Go to $ORACLE_HOME/bin and do the following at the unix prompt:

chmod 751 sqlplus

Then try again.
0
 
mshaikhCommented:
You have to be logged in as oracle to do this.
0
 
syakobsonCommented:
Oops, I clicked Submit to early. I forgot to explain why spool works. SQL*Plus/Server Manager command spool is executed on the CLIENT side by CLIENT process. That is why spool file is owned by client OS username. If client box is different from DB server box, spool file and UTL_FILE created file produced by the same client would end up on different boxes even if both spool command and UTL_FILE.FOPEN would use same file specification.

Solomon Yakobson.
0
All Courses

From novice to tech pro — start learning today.