Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Location
    India
    Posts
    33

    Unhappy Unanswered: UTL_FILE_DIR "ORA-06512" - Urgent

    Hi all,
    Please help me finding the solution for the ORA-06512 error while archiving the content of a table to a flat file, using UTL_FILE_DIR.
    the PL-SQL Script is as follows...

    DECLARE

    fHandle UTL_FILE.FILE_TYPE;

    CURSOR C1 IS SELECT * FROM real.bufferarchive;

    vText C1%ROWTYPE;
    vdate DATE;

    BEGIN

    SELECT SYSDATE INTO vdate FROM DUAL;

    OPEN C1;

    LOOP

    FETCH C1 INTO vText;

    fHandle := UTL_FILE.FOPEN('D:\LOG','Archive_'||vdate||'.txt', 'a');

    UTL_FILE.PUTF(fHandle,vText.user_number||':::');
    UTL_FILE.PUTF(fHandle,vText.user_input||':::');
    UTL_FILE.PUTF(fHandle,vText.system_error_msg_sent| |':::');
    UTL_FILE.PUTF(fHandle,vText.system_error_type||':: :');

    UTL_FILE.FCLOSE(fHandle);

    EXIT WHEN C1%NOTFOUND;


    END LOOP;
    CLOSE C1;

    EXCEPTION

    WHEN UTL_FILE.INVALID_PATH THEN
    RAISE_APPLICATION_ERROR(-20100,'Invalid Path');
    WHEN UTL_FILE.INVALID_MODE THEN
    RAISE_APPLICATION_ERROR(-20101,'Invalid Mode');
    WHEN UTL_FILE.INVALID_OPERATION then
    RAISE_APPLICATION_ERROR(-20102,'Invalid Operation');
    WHEN UTL_FILE.INVALID_FILEHANDLE then
    RAISE_APPLICATION_ERROR(-20103,'Invalid Filehandle');
    WHEN UTL_FILE.WRITE_ERROR then
    RAISE_APPLICATION_ERROR(-20104,'Write Error');
    WHEN UTL_FILE.READ_ERROR then
    RAISE_APPLICATION_ERROR(-20105,'Read Error');
    WHEN UTL_FILE.INTERNAL_ERROR then
    RAISE_APPLICATION_ERROR(-20106,'Internal Error');
    WHEN OTHERS THEN
    UTL_FILE.FCLOSE(fHandle);
    END;
    /

    and the error is coming like this...

    DECLARE
    *
    ERROR at line 1:
    ORA-20104: Write Error
    ORA-06512: at line 53

    ***************************

    Its urgent... pls help... thanks in advance...
    Papps...

  2. #2
    Join Date
    Dec 2003
    Location
    India
    Posts
    33

    Re: UTL_FILE_DIR "ORA-06512" - Urgent

    Sorry for not mentioning this earlier... The OS is Windows 2000 Advanced Server. and db is Oracle9i Enterprise Edition Release 9.2.0.1.0.
    Papps...

  3. #3
    Join Date
    Jan 2004
    Location
    India
    Posts
    191
    Hi,
    Do the following things before runing the block.
    1. Connect to SYS
    2. Create directory
    Create directory as LOG AS 'D:\LOG'
    3. Grant Read to username
    4. specify in INIT.ora file
    UTL_FILE_DIR = <directory name>

    Then execute the plsql block. I ran the same code succefully.

    Also see the below link for help
    http://www.experts-exchange.com/Data..._20811510.html

    Thanks,
    Pagnint
    (No need to search web before posting new question)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •