Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spool file created as default oracle user.

Status
Not open for further replies.

maddave

Technical User
Jan 3, 2002
72
GB
Hello, can anyone help?

I dont know if this is a oracle or a Linux problem.

I have a few Linux shell scripts which when run as one user, say batch3, login to our oracle 9i database as a user and spool the output to a spool file - spool.opt.

The problem is the spool.opt file is being created with the owner as the default Oracle user - oracle9, group oinstall.

This means that the script later on ftps the file then removes it, but it cant becuase its not the owner causing the files to build up each day and then more and more files are ftp'd! You get the picture!

So why is the script which is being run as Linux user batch3, creating spool files as default linux oracle account oracle9?!!

cheers for any help.
 
Dave,

Unlike other text-writing applications (such as "vi", "emacs", et cetera), Oracle (since it is a database server instead of a text editor) does not look at your operating system login to assign ownership to output files that it outputs...It believes that it (Oracle) owns the files that it outputs.

Therefore, since you are not going to convince "Oracle the Server" to behave differently, I suggest that post-process the file with either a "chown" command to change the owner, or "chmod" to change the permissions on the resulting file.

Let us know how things work out for you.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[ Providing low-cost remote Database Admin services]
Click here to join Utah Oracle Users Group on Tek-Tips if you use Oracle in Utah USA.
 
maddave,
I can't reproduce this behavior. Neither RH-Linux nor AIX change the ownership like you described.
Are you sure sqlplus is not overwritten by some alias or script sudo'ing to oracle9?
Who is the owner of the process when you start a sqlplus-session (check via ps)?

Stefan
 
Mufas thanks for the reply. Unfortuantly, one of the commands the script does is a chmod and this doesn't work since the script user is no longer the owner of the file.

Stefanhei, thanks also for the reply. Your answer does seem promising. Adding a bit more to my original question, I tested this on a systm I had built and couldn't replicate the problem, everything worked how it should. It was only on the system that our hosting company had set up that this problme was occurring. I think there could well be an aliase on the sqlplus command which may mean its gets executed by the oracle user. I will have a look. Thanks for the suggestion.

David.
 
Or check that sqlplus is not setuid (and setgid) on that server?

when in the ${ORACLE_HOME}/bin directory, do
ls -l sqlplus

if you see

-rwsr-x--x 1 oracle ... ... sqlplus

then, anybody who runs sqlplus would effectively run as the owner of the sqlplus executable (which is normally the oracle installation user).

If it's

-rwxr-x--x 1 oracle ... ... sqlplus

then there's probably another mechanism like sudo or so in place like Stefan suggested.


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top