Home » SQL & PL/SQL » SQL & PL/SQL » UTL FILE SETTING in Oracle 10G
UTL FILE SETTING in Oracle 10G [message #126000] Thu, 30 June 2005 08:04 Go to next message
nitin_d_csn
Messages: 19
Registered: June 2005
Location: Mumbai
Junior Member

UTL FILE SETTING in Oracle 10G

Can anybody give the solution how to set the directory path

in init.ora in oracle 10G

i have created the dir c:\temp. And in INIT.ORA i have set

set utl_file_dir=c:\temp but i still got error
invalid path.
please help me
Re: UTL FILE SETTING in Oracle 10G [message #126009 is a reply to message #126000] Thu, 30 June 2005 08:54 Go to previous messageGo to next message
dmitry.nikiforov
Messages: 723
Registered: March 2005
Senior Member
Oracle doesn't recommend to use UTL_FILE_DIR parameter.
In place of that you can create DIRECTORY object, grant
READ or WRITE privilege on it to particular users and
use directory alias instead of explicit path name:

SQL> CREATE DIRECTORY BASE_DIR AS 'C:\';

Directory created.

SQL> declare
  2   out_file UTL_FILE.FILE_TYPE;
  3  begin
  4   out_file := UTL_FILE.FOPEN('BASE_DIR','test.txt','r');
  5   UTL_FILE.FCLOSE(out_file);
  6  end;
  7  /

PL/SQL procedure successfully completed.


Be care - directory alias should be always upper-case in
fopen:

SQL> declare
  2   out_file UTL_FILE.FILE_TYPE;
  3  begin
  4   out_file := UTL_FILE.FOPEN('base_dir','test.txt','r');
  5   UTL_FILE.FCLOSE(out_file);
  6  end;
  7  /
declare
*
ERROR at line 1:
ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 33
ORA-06512: at "SYS.UTL_FILE", line 436
ORA-06512: at line 4


Rgds.
Re: UTL FILE SETTING in Oracle 10G [message #126193 is a reply to message #126009] Fri, 01 July 2005 08:24 Go to previous messageGo to next message
nitin_d_csn
Messages: 19
Registered: June 2005
Location: Mumbai
Junior Member

SQL> declare
2 out_file UTL_FILE.FILE_TYPE;
3 begin
4 out_file := UTL_FILE.FOPEN('BASE_DIR','test.txt','r');
5 UTL_FILE.FCLOSE(out_file);
6 end;
7 /
declare
*
ERROR at line 1:
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 475
ORA-29283: invalid file operation
ORA-06512: at line 4

i have run this code but i got the above errors

as per u r directions i have created the dir 'BASE_DIR' grant the

previleges read,write on 'BASE_DIR' but i still got error,i m

using linux server and windows as client.
please help

[Updated on: Fri, 01 July 2005 08:26]

Report message to a moderator

Re: UTL FILE SETTING in Oracle 10G [message #126197 is a reply to message #126193] Fri, 01 July 2005 08:38 Go to previous messageGo to next message
dmitry.nikiforov
Messages: 723
Registered: March 2005
Senior Member
Quote:


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.



Rgds.
Re: UTL FILE SETTING in Oracle 10G [message #126200 is a reply to message #126197] Fri, 01 July 2005 08:54 Go to previous messageGo to next message
dmitry.nikiforov
Messages: 723
Registered: March 2005
Senior Member
...and meanwhile where are you trying to read file ?
UTL_FILE lets you read and write files accessible from the server on which your database is running.

Rgds.
Re: UTL FILE SETTING in Oracle 10G [message #126201 is a reply to message #126200] Fri, 01 July 2005 09:00 Go to previous messageGo to next message
nitin_d_csn
Messages: 19
Registered: June 2005
Location: Mumbai
Junior Member

my database is running on linux server

i m running the code from client but i dont know in linux where

i ve to make the change
Re: UTL FILE SETTING in Oracle 10G [message #182296 is a reply to message #126201] Fri, 14 July 2006 04:27 Go to previous message
jinskim
Messages: 1
Registered: July 2006
Location: Republic of Korea(south)
Junior Member
Pleaes check directory permission...
and try again like below.

chmod 777 Directory

Regards,
jinskim
Previous Topic: Converting varchar field to date
Next Topic: Error in connecting PLSQL developer
Goto Forum:
  


Current Time: Thu Aug 28 00:13:44 CDT 2025