Home » Developer & Programmer » Forms » ORA-29283: invalid file operation (11.2.0.2)
ORA-29283: invalid file operation [message #585122] Wed, 22 May 2013 06:13 Go to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
Hi,

My Application is running on the unix server - user oracle.
My DB is in different unix box. I had created the folder called OUT with the permission of 777 in DB server..
I created ORacle Directory DMPDIR for that folder /OUT. and executed grant read/write to that schema.

1) when i use the below code in sqlplus its writing the file into that folder.
DECLARE
vInHandle utl_file.file_type;
vNewLine VARCHAR2(4000);
BEGIN
vInHandle := utl_file.fopen('DMPDIR', 'text.txt', 'R',32767);

BEGIN
utl_file.get_line(vInHandle, vNewLine);
dbms_output.put_line(vNewLine);
EXCEPTION
WHEN OTHERS THEN
null;
END;
END fopen;

But, when the same piece of code is executed from the package ( which called from the application)its throwing the ORA-29283: invalid file operation.

even i am able to copy the files into that folder with the user oracle.

Any idea, wat i am missing ?.



Re: ORA-29283: invalid file operation [message #585123 is a reply to message #585122] Wed, 22 May 2013 06:26 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
That code doesn't write anything, it reads the file.
That being the case, are you sure your package code does the same thing?
Re: ORA-29283: invalid file operation [message #585124 is a reply to message #585123] Wed, 22 May 2013 06:34 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
sorry..

DECLARE
vInHandle utl_file.file_type;
vNewLine VARCHAR2(4000);
BEGIN
vInHandle := utl_file.fopen('DMPDIR', 'text.txt', 'R',32767);

BEGIN
utl_file.get_line(vInHandle, vNewLine);
dbms_output.put_line(vNewLine);
EXCEPTION
WHEN OTHERS THEN
null;
END;

Re: ORA-29283: invalid file operation [message #585126 is a reply to message #585124] Wed, 22 May 2013 06:38 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Invalid code. You have two BEGINs.

WHEN OTHERS successfully hides anything that might go wrong here, so - are you sure that this is the code that raised ORA-29283?
Re: ORA-29283: invalid file operation [message #585127 is a reply to message #585126] Wed, 22 May 2013 06:40 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
Hi,

DECLARE
vInHandle utl_file.file_type;
vNewLine VARCHAR2(4000);
BEGIN
vInHandle := utl_file.fopen('DMPDIR', 'text.txt', 'R',32767);

BEGIN
utl_file.get_line(vInHandle, vNewLine);
dbms_output.put_line(vNewLine);
EXCEPTION
WHEN OTHERS THEN
null;
END;
END;

I did added to capture the error message. my concern, why this piece of code is working fine in sql plus and not via the package which is called from the front end application.

Re: ORA-29283: invalid file operation [message #585128 is a reply to message #585127] Wed, 22 May 2013 06:49 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What did you add to "capture error message"? You capture nothing, but pretend that everything is OK.

Oracle

ORA-29283: invalid file operation

Cause: An attempt was made to read from a file or directory that does not exist, or file or directory access was denied by the operating system.

Action: Verify file and directory access privileges on the file system, and if reading, verify that the file exists.

[Updated on: Wed, 22 May 2013 06:49]

Report message to a moderator

Re: ORA-29283: invalid file operation [message #585129 is a reply to message #585128] Wed, 22 May 2013 06:54 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
Thanks.

When you execute it from pl/sql developer , the pop up will come and say the error code when the exception is not defined.

Yes , all the access are there.

the folder has the option of chmode 777. from sqlplus the file is getting generated. But file open is returning the invalid file opearation error when it called from the package..

the below is the piece of cod which used in the package...

FUNCTION xxxx(p_msg_body IN CLOB,
p_file_name IN VARCHAR2,
p_file_path IN VARCHAR2,
p_Err_Code IN OUT VARCHAR2,
p_Err_Prms IN OUT VARCHAR2) RETURN BOOLEAN AS

l_file_type UTL_FILE.FILE_TYPE;
buffer VARCHAR2(32767);
amount BINARY_INTEGER;
offset NUMBER(38);
l_write boolean := true;
BEGIN
IF UTL_FILE.is_open(l_file_type) THEN
UTL_FILE.FCLOSE(l_file_type);
END IF;
begin

l_file_type := UTL_FILE.FOPEN('DMPDIR', p_file_name, 'W', 32767);
exception
WHEN OTHERS THEN
l_write := false;
end;
if l_write then
WHILE amount >= buffer_size LOOP
DBMS_LOB.READ(lob_loc => p_msg_body,
amount => amount,
offset => offset,
buffer => buffer);
offset := offset + amount;
UTL_FILE.PUT(file => l_file_type, buffer => buffer);
UTL_FILE.FFLUSH(file => l_file_type);
END LOOP;
end if;
g_file_cnt := g_file_cnt + 1;
utl_file.fclose(l_file_type);
RETURN TRUE;
EXCEPTION
WHEN OTHERS THEN
RETURN FALSE;
END xxxx;

[Updated on: Wed, 22 May 2013 06:55]

Report message to a moderator

Re: ORA-29283: invalid file operation [message #585130 is a reply to message #585128] Wed, 22 May 2013 07:00 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
1) Please read and follow How to use [code] tags and make your code easier to read?
2) Your function can't return the oracle error you say you're getting since the exception handler masks it.
3) The function writes files. All the other code you've posted reads files. The fact that you can read a file doesn't prove you can write it. If you're trying to write to a file that already exists you should probably be using an open_mode of a (append).
Re: ORA-29283: invalid file operation [message #585131 is a reply to message #585130] Wed, 22 May 2013 07:04 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
Sorry about the formatting.

1)

DECLARE
vInHandle utl_file.file_type;
vNewLine VARCHAR2(4000);
v_sql varchar2(3000);
BEGIN
vInHandle := utl_file.fopen('DMPDIR', 'text.txt', 'W', 32767);
utl_file.put_line(vInHandle, 'ARULSARAN');
dbms_output.put_line(vNewLine);
EXCEPTION
WHEN OTHERS THEN
v_sql := substr(sqlerrm,1,3000);
dbms_output.put_line (v_sql);
END;

2)
FUNCTION xxxx(p_msg_body IN CLOB,
p_file_name IN VARCHAR2,
p_file_path IN VARCHAR2,
p_Err_Code IN OUT VARCHAR2,
p_Err_Prms IN OUT VARCHAR2) RETURN BOOLEAN AS

l_file_type UTL_FILE.FILE_TYPE;
buffer VARCHAR2(32767);
amount BINARY_INTEGER;
offset NUMBER(38);
l_write boolean := true;
v_sql varchar2(3000);

BEGIN
IF UTL_FILE.is_open(l_file_type) THEN
UTL_FILE.FCLOSE(l_file_type);
END IF;
begin

l_file_type := UTL_FILE.FOPEN('DMPDIR', p_file_name, 'W', 32767);
exception
WHEN OTHERS THEN
v_sql := substr(sqlerrm, 1, 3000);
dbms_output.put_line(v_sql);
l_write := false;
end;
if l_write then
WHILE amount >= buffer_size LOOP
DBMS_LOB.READ(lob_loc => p_msg_body,
amount => amount,
offset => offset,
buffer => buffer);
offset := offset + amount;
UTL_FILE.PUT(file => l_file_type, buffer => buffer);
UTL_FILE.FFLUSH(file => l_file_type);
END LOOP;
end if;
g_file_cnt := g_file_cnt + 1;
utl_file.fclose(l_file_type);
RETURN TRUE;
EXCEPTION
WHEN OTHERS THEN
v_sql := substr(sqlerrm, 1, 3000);
dbms_output.put_line(v_sql);

RETURN FALSE;
END xxxx;


[Updated on: Wed, 22 May 2013 07:04]

Report message to a moderator

Re: ORA-29283: invalid file operation [message #585132 is a reply to message #585131] Wed, 22 May 2013 07:10 Go to previous messageGo to next message
Michel Cadot
Messages: 68665
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Still not formatted.
Still WHEN OTHERS until you remove it you will never understand what happens and you will have sooner or later big problems with the procedure.

Read WHEN OTHERS.

Regards
Michel
Re: ORA-29283: invalid file operation [message #585135 is a reply to message #585132] Wed, 22 May 2013 07:12 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
i formatted.. but when i post it again going in the wrong format Sad.. this piece i extracted and modified from the original package code in the understandable manner.

question , what it cause the problem , what makes the different between running in sql plus and in package, why it cause the problem ?.
Re: ORA-29283: invalid file operation [message #585136 is a reply to message #585135] Wed, 22 May 2013 07:16 Go to previous messageGo to next message
Michel Cadot
Messages: 68665
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
i formatted.. but when i post it again going in the wrong format


Because you didn't read the link cookiemonster gave you in his point 1.

Quote:
question , what it cause the problem , what makes the different between running in sql plus and in package, why it cause the problem ?


First remove the WHEN OTHERS part and read the link. Then retry and post the result.

Regards
Michel
Re: ORA-29283: invalid file operation [message #585137 is a reply to message #585136] Wed, 22 May 2013 07:26 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
arulsaran wrote on Wed, 22 May 2013 13:12
question , what it cause the problem , what makes the different between running in sql plus and in package, why it cause the problem ?.


cookiemonster wrote on Wed, 22 May 2013 13:00

3) The function writes files. All the other code you've posted reads files. The fact that you can read a file doesn't prove you can write it. If you're trying to write to a file that already exists you should probably be using an open_mode of a (append).


Or to put it more simply (though I really shouldn't need to): the package code and the sqlplus code do different things
Re: ORA-29283: invalid file operation [message #585138 is a reply to message #585137] Wed, 22 May 2013 07:37 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
Make it simple..

created OUT folder with the owner oracle ( ch mode 777).
No files in the OUT folder. say each time i remove all the files from that folder.

DMPDIR mapped to OUT folder in DB unix box which has the 777 access to oracle user.
and read / write permission are granted to the schema say sample.

1) my application ( running in oracle owner) also connecting to that sample schema and call that function which has the below line- it fails with -invalid file operation.
2) i connect through sqlplus/pl-sql developer and ran the stuff which has the same line. file got created..
3) no matter what i am writing into that file.
l_file_type := UTL_FILE.FOPEN('DMPDIR', 'sample.txt', 'W', 32767);



Re: ORA-29283: invalid file operation [message #585139 is a reply to message #585138] Wed, 22 May 2013 07:43 Go to previous messageGo to next message
Michel Cadot
Messages: 68665
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Make it simple: SHOW US.
Please read OraFAQ Forum Guide.

Regards
Michel
Re: ORA-29283: invalid file operation [message #585140 is a reply to message #585139] Wed, 22 May 2013 07:46 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
Hi,

I tried in forum , what i got is , all is saying the folder permission or / directory permissions..

but i am facing a difficult issue. something is working when it runs from pl/sql code and not from the function which is called from the application.

Re: ORA-29283: invalid file operation [message #585144 is a reply to message #585140] Wed, 22 May 2013 08:09 Go to previous messageGo to next message
Michel Cadot
Messages: 68665
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Michel Cadot wrote on Wed, 22 May 2013 14:43
Make it simple: SHOW US.
Please read OraFAQ Forum Guide.


Show us means copy and paste your SQL*Plus session.

Regards
Michel

[Updated on: Wed, 22 May 2013 08:10]

Report message to a moderator

Re: ORA-29283: invalid file operation [message #585145 is a reply to message #585138] Wed, 22 May 2013 08:11 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
arulsaran wrote on Wed, 22 May 2013 13:37

2) i connect through sqlplus/pl-sql developer and ran the stuff which has the same line. file got created..
3) no matter what i am writing into that file.
l_file_type := UTL_FILE.FOPEN('DMPDIR', 'sample.txt', 'W', 32767);

Not according to all your previous posts you didn't.
1st post:
utl_file.fopen('DMPDIR', 'text.txt', 'R',32767);

2nd post:
utl_file.fopen('DMPDIR', 'text.txt', 'R',32767);

3rd post:
utl_file.fopen('DMPDIR', 'text.txt', 'R',32767);


See those 'R' - they're not the same as 'W' are they?

You need to start paying attention to what you write.
Re: ORA-29283: invalid file operation [message #585190 is a reply to message #585145] Wed, 22 May 2013 15:41 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
(I hope he won't say "Oh, that's what R and W stand for!!!" and that he used R because he found such an example somewhere on the Internet.)
Re: ORA-29283: invalid file operation [message #585209 is a reply to message #585190] Thu, 23 May 2013 00:34 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
Littlefoot, Don't thing all will do what u do.. forget it. ( that mistake is happened because i was trying whether i am able to read the file from the folder ).

@Michel Cadot , Please see the out puts.. The thing is that the problem is in the production and i am supporting from the offshore.

1)
SQL> set serveroutput on;
SQL> DECLARE
2 vInHandle utl_file.file_type;
3 vNewLine VARCHAR2(4000);
4 v_sql varchar2(3000);
5 BEGIN
6 vInHandle := utl_file.fopen('DMPDIR', 'text.txt', 'W', 32767);
7 utl_file.put_line(vInHandle, 'ARULSARAN');
8 dbms_output.put_line(vNewLine);
9 EXCEPTION
10 WHEN OTHERS THEN
11 v_sql := substr(sqlerrm,1,3000);
12 dbms_output.put_line (v_sql);
13 END;
14 /

PL/SQL procedure successfully completed.

SQL>

File created in the Out directory

2)
the below function is present in the package i.e ( Pkg_write ).
FUNCTION fn_write_file(p_msg_body IN varchar2,
p_file_name IN VARCHAR2,
p_file_path IN VARCHAR2,
p_Err_Code IN OUT VARCHAR2,
p_Err_Prms IN OUT VARCHAR2) RETURN BOOLEAN AS
l_file_type UTL_FILE.FILE_TYPE;
buffer VARCHAR2(32767);
amount BINARY_INTEGER;
offset NUMBER(38);
l_write boolean := true;
v_sql varchar2(3000);
BEGIN
IF UTL_FILE.is_open(l_file_type) THEN
UTL_FILE.FCLOSE(l_file_type);
END IF;
begin
l_file_type := UTL_FILE.FOPEN('DMPDIR', p_file_name, 'W', 32767);
exception
WHEN OTHERS THEN
v_sql := substr(sqlerrm, 1, 3000);
dbms_output.put_line(v_sql);
l_write := false;
end;
utl_file.put_line (l_file_type , 'ARULSARAN');
utl_file.fclose(l_file_type);
RETURN TRUE;
EXCEPTION
WHEN OTHERS THEN
v_sql := substr(sqlerrm, 1, 3000);
dbms_output.put_line(v_sql);
RETURN FALSE;
END fn_write_file;

----------

2) when i call this function from sqlplus its working fine.


SQL> ed
Wrote file afiedt.buf

1 declare
2 p_msg_body varchar2(100) :='ARULSARAN';
3 p_file_name varchar2(100) :='text1.txt';
4 p_file_path varchar2(100) :='DMPDIR';
5 p_Err_Code varchar2(100);
6 p_Err_Prms varchar2(100);
7 l_ret boolean;
8 begin
9 l_ret := Pkg_write.fn_write_file (
10 p_msg_body ,
11 p_file_name ,
12 p_file_path ,
13 p_Err_Code ,
14 p_Err_Prms );
15* end;
16 /

PL/SQL procedure successfully completed.

SQL>

3) but the same function is called via the front end application
its giving the below error.

ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 488
ORA-29283: invalid file operation

Re: ORA-29283: invalid file operation [message #585214 is a reply to message #585209] Thu, 23 May 2013 01:17 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What happens if you create a stored procedure (or a function, your choice), using code you posted under "2) when i call this function from sqlplus its working fine." and call that procedure from the front end application?
Re: ORA-29283: invalid file operation [message #585219 is a reply to message #585214] Thu, 23 May 2013 01:27 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
@Littlefoot , this error is happening in the production.. the package call is made in the front end application ( java). i do not have rights to change the call to function or procedure.
I tried to create the standalone function and called from the sqlplus, its working fine.
I did checked with the application server guys and they confirmed that the app server instance are running with the user oracle.

In the pcakgae-function , i put the debug message to capture the os_user using the below and it returns null.
dbg(SYS_CONTEXT('USERENV','OS_USER') ); (dbg is our autonomous proc which stores the external messages ).

select * from v$parameter where name like 'open_cursor%' -- 2000
select * from v$parameter where name like 'utl_file_dir%' -- *
GRANT READ,WRITE ON DIRECTORY DMPDIR TO <SCHEMA>

Please let me know , any other input would you need from DB/APP server environment.
Re: ORA-29283: invalid file operation [message #585225 is a reply to message #585219] Thu, 23 May 2013 01:45 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Oracle message ("... or file or directory access was denied by the operating system") along with the result of SYS_CONTEXT (which is NULL. Why is it NULL? How can OS_USER be NULL?) *might* be a problem. Unfortunately, I wouldn't know how to solve it (I don't know Java, I don't use Unix ... what am I doing here, eh?). Hopefully, someone else will be able to assist.
Re: ORA-29283: invalid file operation [message #585228 is a reply to message #585225] Thu, 23 May 2013 01:49 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
Yeah Littlefoot. the worst thing is that , we have some other same kind of proc which does the message writing in to some other folder.
When i gave the dmpdir path , those procs are able to write the files. (*there also OS_USER returns null ).
Re: ORA-29283: invalid file operation [message #585229 is a reply to message #585228] Thu, 23 May 2013 01:52 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Just to verify - is there enough free space in DMPDIR directory?
Re: ORA-29283: invalid file operation [message #585230 is a reply to message #585229] Thu, 23 May 2013 01:54 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
Yes, Otherwise how it will allow to create a file when we ran from the sqlplus. Is that any possibility that the os_user became null in Database code.

our application has around 3000+ tables and alomost 1000+ package and functions.. Sad.
Re: ORA-29283: invalid file operation [message #585237 is a reply to message #585230] Thu, 23 May 2013 02:52 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Either you've rewritten bits of the function before posting it here or the function makes no sense.
The function has 5 parameters. The code uses 1 of them.
I suspect your real problem is that when the function is called from the application it isn't passing DMPDIR as the directory.
Re: ORA-29283: invalid file operation [message #585251 is a reply to message #585237] Thu, 23 May 2013 03:44 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
no its passing.. that function actually does lot of other calculations. i don't want post those code's here. so i removed other code of that functions and posted only the file written parts. actually in that function i commented all the codes and kept only the parameters what i passed it here...
Re: ORA-29283: invalid file operation [message #585255 is a reply to message #585251] Thu, 23 May 2013 03:53 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
So in reality the function does use p_file_path?
Re: ORA-29283: invalid file operation [message #585257 is a reply to message #585255] Thu, 23 May 2013 03:55 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
yes. it uses all the parameters.. here i want to make sure that it uses the same value what i am using in the pl/sql code.
Re: ORA-29283: invalid file operation [message #585258 is a reply to message #585255] Thu, 23 May 2013 03:55 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Or maybe the other code you left out is what's causing the problem.
Bottom line: if the function works from sqlplus then there shouldn't be any reason why it would fail when called from the application with the same parameters.
Re: ORA-29283: invalid file operation [message #585259 is a reply to message #585258] Thu, 23 May 2013 04:00 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
Yes , that's where i am also not able to identify the problem. but for testing , i commented the original codes and i gave only what i gave it in the fn_write_file of above. it exactly same as what i mentioned here..

if i call that function from pl/sql it works create file. but from app server it fails.

i tried to write / read / even delete functionality, nothing works from app server.

this is our product code and it works for other environment's.

Re: ORA-29283: invalid file operation [message #585270 is a reply to message #585259] Thu, 23 May 2013 05:44 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
So presumably the app is using different parameter values to what you are testing with.
Re: ORA-29283: invalid file operation [message #585271 is a reply to message #585270] Thu, 23 May 2013 05:46 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
yes.. the file name will be based on the timestamp , but directory will be remain same.
Re: ORA-29283: invalid file operation [message #585274 is a reply to message #585271] Thu, 23 May 2013 06:51 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
I'd double check that if I was you.
If you have a function that writes a file to a specific directory it'll work the same no matter where it's called from.
The only sensible thing to do is find out all the parameters the app is passing to the function then try calling the function from sqlplus with the exact same set of parameters.
Re: ORA-29283: invalid file operation [message #585275 is a reply to message #585274] Thu, 23 May 2013 06:57 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
yes we did so. we tried all the possibilities..

This function is not directly called from the app server, its called from the other function where it taken directory and file name from the maintenance table. the file name will be append with the yyyymmddhhmiss..etc..

the file name will be like intially it passed like

('/u002fs/debug/OUT', 'S202SDDDASHETAA130520030509003.0053.XML', 'W',32767);

but i have hard coded in the function to make sure that i am using the same parameters in sqlplus and functions..

even though i tested with the same file name.. it works in sqlplus..

does it matter the OS_USER.. SYS_CONTEXT('USERENV','OS_USER') returns null..
my doubt is , the folder owner is oracle and has the permission of 777. but here , before the call to fopen in function OS_USER returns null ..
Re: ORA-29283: invalid file operation [message #585276 is a reply to message #585275] Thu, 23 May 2013 07:15 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
arulsaran wrote on Thu, 23 May 2013 12:57

('/u002fs/debug/OUT'

The above is not an oracle directory object name. So if it's not translated into a directory object name before calling utl_file that'll cause your error. If it is translated then I suggest you double check what it is translated into. I rather suspect it's not DMPDIR.
Everything you've posted so far points towards the problem being due to the application not writing the file you think it is.

OS_USER is irrelevant to this.
Re: ORA-29283: invalid file operation [message #585277 is a reply to message #585276] Thu, 23 May 2013 07:28 Go to previous messageGo to next message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
Hi,

I did the below checks before i post it.

1) folder owner is oracle
2) ch mode 777
3) login through putty/winscp with the oracle user , i am able to create/delete/change the files
4) i logged into the appserver with the oracle user
connected through sqlplus ran the pl/sql code with the mentioned parameters , file get genareted
5) repeated point no 4 from db server. works well
6) Directory dmpdir granted read /write to schema user.
7) we modified that function for reading the file,it gave the same error.

8) *** if os_user returns null, what might be the file owner , i am not good at unix.

App server is running in different UNIX box and DB server in different UNIX box.
Both app and db is running in the oracle user ( this is confirmed by the DBA's).

'/u002fs/debug/OUT' is maintained in the table, and initially i thought the path might be the problem.

i had changed it to the directory with the grants.. for checking purpose ,i hard coded the directory in the function.

This function call is made from java. i did the double check, this call is not made from the oracle jobs.

path / filename everything i gave it what i mentioned in the previous post. Still failing.

[CM - disabled smilies]

[Updated on: Thu, 23 May 2013 07:47] by Moderator

Report message to a moderator

Re: ORA-29283: invalid file operation [message #585279 is a reply to message #585277] Thu, 23 May 2013 07:47 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
arulsaran wrote on Thu, 23 May 2013 13:28

8) *** if os_user returns null, what might be the file owner , i am not good at unix.

oracle. All files written by utl_file are actual written by the oracle processes, which all run under the oracle user.
The os_user of the client (sqlplus or the application), which is what sys_context gives, is irrelevant.

arulsaran wrote on Thu, 23 May 2013 13:28

'/u002fs/debug/OUT' is maintained in the table, and initially i thought the path might be the problem.

As I said before, unless that path is converted to the name of an oracle directory object before calling utl_file it's definitely a problem.

Only two users are relevant here:
1) the os user of oracle itself on the DB server - which should be called oracle. It needs read/write on the directory on the db server.
2) The oracle db user you're logged in as. That user needs read/write on the oracle directory object that you are trying to use.

Are you sure java is logged in as the same user you are using in sqlplus?
Re: ORA-29283: invalid file operation [message #585281 is a reply to message #585279] Thu, 23 May 2013 07:58 Go to previous messageGo to previous message
arulsaran
Messages: 26
Registered: May 2013
Location: bangalore
Junior Member
DBA confirmed that its in the oracle user.

because the same application is calling some other packages to do the file upload / download purpose.

and the same piece of code is work fine for other client places. we don't do any special maintenance at all.

[Updated on: Thu, 23 May 2013 08:01]

Report message to a moderator

Previous Topic: frm-92101: there was a failur in the forms server during startup.this could due to invalid configura
Next Topic: check box pass value
Goto Forum:
  


Current Time: Wed Jul 03 12:24:28 CDT 2024