Solved

ORA-29285 File Write error

Posted on 2009-07-13
6
4,056 Views
Last Modified: 2012-08-14
I am writing a stored procedure that writes to a file. Code pertaining to utl_file -

v_feed_out               UTL_FILE.FILE_TYPE;

BEGIN
  IF UTL_FILE.IS_OPEN (v_feed_out)
    THEN UTL_FILE.FCLOSE (v_feed_out);
  END IF;
 v_feed_out := utl_file.fopen('FAMIS_OUTPUT_DIR', 'ABC','w');


  OPEN ref_cursor for 'select * from ' || v_tbl_tmp;
  LOOP
       FETCH ref_cursor INTO V_DTL_REC.NAME,
                           V_DTL_REC.GENDER,
                           V_DTL_REC.STREET,
                           V_DTL_REC.CITY,
                           V_DTL_REC.STATE,
                           V_DTL_REC.ZIP,
                           V_DTL_REC.DOB,
                           V_DTL_REC.CLSSFCN,
                           V_DTL_REC.STATE_OF_ORIGIN,
                           V_DTL_REC.PHONE;
                           
                           
     
       V_DTL_REC.NAME := LPAD( V_DTL_REC.NAME, 120 );
       V_DTL_REC.STREET := LPAD( V_DTL_REC.STREET, 120 );
       V_DTL_REC.CITY := LPAD( V_DTL_REC.CITY, 25 );
       V_DTL_REC.STATE := LPAD( V_DTL_REC.STATE, 2 );
       V_DTL_REC.ZIP := LPAD( V_DTL_REC.ZIP, 10 );
       V_DTL_REC.STATE_OF_ORIGIN := LPAD( V_DTL_REC.STATE_OF_ORIGIN, 3 );
       V_DTL_REC.PHONE := LPAD( V_DTL_REC.PHONE, 10 );
       V_DTL_REC.UIN := LPAD( V_DTL_REC.UIN, 9 );
       
       V_OUTPUT_REC:=  V_DTL_REC.NAME ||
                       V_DTL_REC.STREET ||
                       V_DTL_REC.CITY ||
                       V_DTL_REC.STATE ||
                       V_DTL_REC.ZIP ||
                       V_DTL_REC.DOB ||
                       V_DTL_REC.CLSSFCN ||
                       V_DTL_REC.STATE_OF_ORIGIN ||
                       V_DTL_REC.PHONE ||
                       V_DTL_REC.UIN;
                     
       /*DBMS_OUTPUT.put_line( V_OUTPUT_REC ); */
       utl_file.put_line(v_feed_out, v_output_rec, TRUE);  
                           
       
   END LOOP;
   utl_file.fclose_all()
END;

When I am debugging, I see that atleast six rows have been processed and then I get a

ORA-29285: file write error
ORA-06512: at "SYS.UTL_FILE", line 171
ORA-06512: at "SYS.UTL_FILE", line 1093
ORA-06512: at "SYS.UTL_FILE", line 821

The data which is being read looks good to me. I dont know what I am missing. The output file is being created, but not all rows that have been looped through were written into the file.

Thanks

 

 
0
Comment
Question by:happylife1234
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 48

Expert Comment

by:schwertner
ID: 24840177
The directory  'FAMIS_OUTPUT_DIR' should be defined correctly
1. It should exist as logical directory,
2. The user should given write access to it
3. The underlying physical directory should exist
4. The oracle OS user should have permissions to write there.
0
 

Author Comment

by:happylife1234
ID: 24840216
The directory is set properly. Both logical and physical and The output file has been created with few rows written to it.
0
 
LVL 48

Accepted Solution

by:
schwertner earned 250 total points
ID: 24840282
Disk is full.
Some of the columns is a LOB
0
Industry Leaders: 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!

 
LVL 48

Expert Comment

by:schwertner
ID: 24840343
Also if the file exists you shoul use 'append' mode
0
 

Author Comment

by:happylife1234
ID: 24840591
I want to overwrite the same file everythime I run this stored procedure. And the disk is not full since I am able to run another store procedure that can write to the same folder. None of the columns are LOB they are simple names and addresses columns.

I dont know what could be the problem then.
0
 
LVL 48

Expert Comment

by:schwertner
ID: 24841862
Remove the file first.

The FREMOVE procedure removes a file from the system.

FREMOVE(location VARCHAR2, filename VARCHAR2)
An exception is thrown if the file to be removed does not exist.

Parameters

location

Directory name, as stored in pg_catalog.edb_dir.dirname, of the directory containing the file to be removed.

filename

Name of the file to be removed.

Examples

The following removes file empfile.csv.

DECLARE
    v_directory     VARCHAR2(50) := 'empdir';
    v_filename      VARCHAR2(20) := 'empfile.csv';
BEGIN
    UTL_FILE.FREMOVE(v_directory,v_filename);
    DBMS_OUTPUT.PUT_LINE('Removed file: ' || v_filename);
    EXCEPTION
        WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE('SQLERRM: ' || SQLERRM);
            DBMS_OUTPUT.PUT_LINE('SQLCODE: ' || SQLCODE);
END;

Removed file: empfile.csv
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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 information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

695 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