?
Solved

utl_file_dir in oracle 10g - gives invalid path error..

Posted on 2007-07-19
6
Medium Priority
?
3,786 Views
Last Modified: 2008-02-20
I have a sample procedure which when executed gives

CREATE OR REPLACE PROCEDURE EmployeeFlatFile
IS
  file_id UTL_FILE.FILE_TYPE;
BEGIN
  file_id := utl_file.FOPEN( '/apps/myuser/output', 'test.txt', 'w' );
  FOR emp IN (SELECT employee_name FROM employee)
  LOOP
     utl_file.PUT_LINE( file_id, emp.employee_name );
  END LOOP;
  utl_file.fCLOSE(file_id);
END;
/
ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 33
ORA-06512: at "SYS.UTL_FILE", line 436
ORA-06512: at "myschema.employeeflatfile", line 5
ORA-06512: at line 2

dba's assured that they have the entry /apps/myuser/output in the utl_file_dir (init.ora) and the same setting works in oracle 8i - how do I rectify this problem,.. any suggestions are welcome!!!


0
Comment
Question by:mahjag
  • 3
  • 2
6 Comments
 
LVL 14

Accepted Solution

by:
sathyagiri earned 500 total points
ID: 19526414
Ask your DBA to create a directory object pouinting to the above dir and grant access to you

CREATE DIRECTORY OUTPUT AS '/apps/myuser/output'

GRANT READ,WRITE ON DIRECTORY output TO user;

In your stored proce replace the abosulute path with this name <OUTPUT>
0
 

Author Comment

by:mahjag
ID: 19526627
DBA's are gone for the day, it will be tomorrow that I can try this,.,

can I find out from querying 8i has the directory name created there, I dont see this as a problem in 8i and wanted to find out if this is just 10g problem..
0
 
LVL 14

Expert Comment

by:sathyagiri
ID: 19526908
select * from all_directories;
0
Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

 
LVL 27

Expert Comment

by:sujith80
ID: 19528548
Check whether the directory exists in the file system. And check whether there are sufficient access permissions on this directory.

It is advisable that you change the code to use directory objects instead of utl_file_dir.
0
 

Author Comment

by:mahjag
ID: 19533433
directories have all read write execute chmod 777 output
0
 

Author Comment

by:mahjag
ID: 19534101
DBA's are letting me know that they only want to change init.ora util_file_dir parameter and not do the directories as the former worked fine in all previous versions..

One problem though that multiple path provided for util_file_dir did not work, only one path,"/apps/myuser/output" worked but I wanted also multiple path to work , like wanted to generate files in different folders but unfortunately we cannot do that now.. Any ideas?

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
utl_file_dir                         string      /apps/myuser/output,/apps/myuser
                                                 /dealer,/apps/myuser/direct

This setting is not working..
                                                 
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Suggested Courses
Course of the Month15 days, 5 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question