Home » Other » Client Tools » calling oraenv from inside the script ,does it change the user? (AIX oracle 10g)
calling oraenv from inside the script ,does it change the user? [message #381196] Thu, 15 January 2009 11:44 Go to next message
ykozhevnikov
Messages: 59
Registered: November 2008
Location: USA
Member
I found that sqlplus when I am trying to use utl_file.fopen utility ( utility to create files from inside PL/SQL) gives me an error.

It looks like the user who started the process ,not the same user who runinig the process.
The process sqlplus is not allowed to write file in particular directory.

Directory belongs to the user who started the script.
When I change permissions for directory and allow group members to write in this directory--> It starts working.


Thanks
Re: calling oraenv from inside the script ,does it change the user? [message #381198 is a reply to message #381196] Thu, 15 January 2009 11:52 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you.


Do NOT describe what you think you see.
use CUT & PASTE to show us exactly what is happening (or not).
Re: calling oraenv from inside the script ,does it change the user? [message #381199 is a reply to message #381196] Thu, 15 January 2009 12:00 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Oracle writes the file NOT the user.
So Oracle must have the privileges to write it.

Regards
Michel
Re: calling oraenv from inside the script ,does it change the user? [message #381201 is a reply to message #381199] Thu, 15 January 2009 12:55 Go to previous messageGo to next message
ykozhevnikov
Messages: 59
Registered: November 2008
Location: USA
Member
Thanks Michel.
A)
/* I just want to show what has been done. */
/* from oracle client as system user */
create or replace directory caspa as '/home/prodsub/logs';

select * from dba_directories;

grant read ,write  on directory caspa to baninst1;

B)
/* script that I run */
set serveroutput on;
set verify off



declare 

  vOutHandle utl_file.file_type;
  
begin

dbms_output.put_line('Simple example working with file');
vOutHandle := utl_file.fopen('CASPA', 'CAS', 'w' );
 

   IF utl_file.is_open(vOutHandle) THEN
    utl_file.fclose_all;
    dbms_output.put_line('Closed All');
    END IF;



END; 

C)
/* unix system */


172:/home/prodsub->whoami
prodsub
172:/home/prodsub->ls -l|grep logs
drwxr-x--x   5 prodsub  banner         4096 Jan 15 12:20 logs
172:/home/prodsub->

D) vi /etc/group
snapp:!:13:snapp
ipsec:!:200:
dba:!:301:oracle,banner,twalker
banner:!:302:banner,banjobs,frscvt,convert1,convert2,convert3,convert4,convert5,
convert6,convert7,convert9,prodsub,hmc,twalker
oinstall:!:303:oracle


Whem I change permmisions for log directory .
172:/home/prodsub->ls -l|grep logs
drwxrwx--x   5 prodsub  banner         4096 Jan 15 12:20 logs

It starts working. But Bunner group does not include oracle.

Thanks for your help


[Mod-Edit: Frank added [code]-tags to improve readability]

[Updated on: Fri, 16 January 2009 00:43] by Moderator

Report message to a moderator

Re: calling oraenv from inside the script ,does it change the user? [message #381202 is a reply to message #381201] Thu, 15 January 2009 13:09 Go to previous message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
1/
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags.
Use the "Preview Message" button to verify.

2/
You didn't show the most important points:
- who start sqlplus
- how do you call sqlplus and connect to the database
- if remotely, who starts the listener
- what are the privileges on oracle binary

3/
BlackSwan
Do NOT describe what you think you see.
use CUT & PASTE to show us exactly what is happening (or not).


Regards
Michel
Previous Topic: IsqlPlus connecting problem
Next Topic: Knowledge Xpert for PL/SQL Authorization Key
Goto Forum:
  


Current Time: Sun Dec 22 12:07:30 CST 2024