Home » SQL & PL/SQL » SQL & PL/SQL » UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties (Oracle 11g)
UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579459] Tue, 12 March 2013 06:48 Go to next message
Lazydba
Messages: 6
Registered: March 2013
Junior Member

I have writtenonce UTL_FILE code but getting "ORA-29283: invalid file operation" error. Please suggest.

Performed below steps while writting code,

CONNECT / AS SYSDBA

CREATE OR REPLACE DIRECTORY DIR_EXTRACT AS 'P:\tmp';

GRANT READ, WRITE ON DIRECTORY DIR_EXTRACT TO User1;

GRANT EXECUTE ON UTL_FILE TO User1;

Connect User1/User1

DECLARE
fHandler UTL_FILE.FILE_TYPE;
BEGIN
fHandler := UTL_FILE.FOPEN('DIR_EXTRACT', 'myfile.txt', 'w');
UTL_FILE.PUTF(fHandler, 'Look ma, I''m writing to a file!!!n');
UTL_FILE.FCLOSE(fHandler);
EXCEPTION
WHEN utl_file.invalid_path THEN
raise_application_error(-20000,'ERROR: Invalid path. Create directory or set UTL_FILE_DIR.');
END;
/

After typing this code i have got the error...

ERROR at line 1:
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 449
ORA-29283: invalid file operation
ORA-06512: at line 4

Then as per one of solution on Orafaq, I have executed below steps,

Connect User1/User1
SQL> HOST MD P:\tmp

Now again run a same code i.e.,

DECLARE
fHandler UTL_FILE.FILE_TYPE;
BEGIN
fHandler := UTL_FILE.FOPEN('DIR_EXTRACT', 'myfile.txt', 'w');
UTL_FILE.PUTF(fHandler, 'Look ma, I''m writing to a file!!!n');
UTL_FILE.FCLOSE(fHandler);
EXCEPTION
WHEN utl_file.invalid_path THEN
raise_application_error(-20000, 'ERROR: Invalid path. Create directory or set UTL_FILE_DIR.');
END;
/

Still getting same error, Please suggest,

ERROR at line 1:
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 449
ORA-29283: invalid file operation
ORA-06512: at line 4
Re: UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579461 is a reply to message #579459] Tue, 12 March 2013 06:51 Go to previous messageGo to next message
cookiemonster
Messages: 13967
Registered: September 2008
Location: Rainy Manchester
Senior Member
Is the directory on the same server as the DB?
Re: UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579462 is a reply to message #579461] Tue, 12 March 2013 06:52 Go to previous messageGo to next message
Lazydba
Messages: 6
Registered: March 2013
Junior Member

No.... Directory exist on Virtual Machine.
Re: UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579464 is a reply to message #579462] Tue, 12 March 2013 06:53 Go to previous messageGo to next message
cookiemonster
Messages: 13967
Registered: September 2008
Location: Rainy Manchester
Senior Member
And you expect the DB to find this directory how exactly?
Re: UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579466 is a reply to message #579464] Tue, 12 March 2013 06:56 Go to previous messageGo to next message
Lazydba
Messages: 6
Registered: March 2013
Junior Member

Earlier, I have mentioned VM exact path name too while creating directory,

i.e.

CREATE OR REPLACE DIRECTORY EXTRACT_DIR AS '\\<Virtual_Machine_Name>\temp';

Still it gives same error.
Re: UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579469 is a reply to message #579466] Tue, 12 March 2013 07:00 Go to previous messageGo to next message
Michel Cadot
Messages: 68767
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
I don't think Oracle supports UNC in this case.

Regards
Michel
Re: UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579471 is a reply to message #579469] Tue, 12 March 2013 07:04 Go to previous messageGo to next message
Lazydba
Messages: 6
Registered: March 2013
Junior Member

In this case, Do we have any alternative to achive file writing functionality on VM if yes then how?
Re: UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579474 is a reply to message #579471] Tue, 12 March 2013 07:34 Go to previous messageGo to next message
Michel Cadot
Messages: 68767
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
I have not.

Regards
Michel
Re: UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579479 is a reply to message #579474] Tue, 12 March 2013 08:14 Go to previous messageGo to next message
Lazydba
Messages: 6
Registered: March 2013
Junior Member


If we can not write file directly on VM then we can write file first on DB server and then transfer it on required location. Is this possible? if you think yes then can you please suggest how we can transfer file from one place to another.
Re: UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579481 is a reply to message #579479] Tue, 12 March 2013 08:24 Go to previous messageGo to next message
dariyoosh
Messages: 538
Registered: March 2009
Location: France
Senior Member
Lazydba wrote on Tue, 12 March 2013 14:14

If we can not write file directly on VM then we can write file first on DB server and then transfer it on required location. Is this possible? if you think yes then can you please suggest how we can transfer file from one place to another.


Just to give you an idea

http://www.linuxquestions.org/questions/programming-9/how-to-invoke-ftp-from-korn-shell-29591/


Regards,
Dariyoosh

[Updated on: Tue, 12 March 2013 08:26]

Report message to a moderator

Re: UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579532 is a reply to message #579481] Wed, 13 March 2013 00:26 Go to previous messageGo to next message
Lazydba
Messages: 6
Registered: March 2013
Junior Member

Hi,
Thanks for your feedback but u provided me answer in Unix. I am serching for solution to transfer file through Oracle.
Re: UTL_FILE : Getting ORA-29283: invalid file operation error after performing all pre-requisties [message #579534 is a reply to message #579532] Wed, 13 March 2013 00:32 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>I am serching for solution to transfer file through Oracle.
File transfer is only EVER done by OS/file system; NEVER by any RDBMS like Oracle.
Previous Topic: merge - update when id column is matched, but one of others columns not
Next Topic: Help with reporting
Goto Forum:
  


Current Time: Sat Aug 23 04:33:50 CDT 2025