Utl_file limitation of 2 GB?

Hello,
I have files which have more than 10 million records which needs to be written to flat file and saved off. I have a routine which uses UTL_FILE functionality to write the file out of Oracle 8i database. But, somehow the files stop at 2 GB limit? Where can I set this limit to write to more than 2GB file? OS does not have the 2GB limit. Is there a better way to extract the files without UTL_FILE?
Also, using the avg_row_len I have set the linesize but some columns which occupy about 256 bytes - how do I calculate the linesize for these columns?
Please help.

Depending on your file system
Solaris size limits are:
Release Max file-system size Max OS File size
before
Solaris 2.6 1Tb (UFS) 2Gb
from and after
Solaris 2.6 1Tb (40 bits) 1Tb
Hope this helps
Bye Alessandro
Edited by: Alessandro Rossi on 24-set-2008 11.29

Similar Messages

  • UTL_FILE limitation

    I am implementing an EDI process which requires that acknowledgments I will send back be one long text file. How can I write my CLOB to a text file without line breaks? The CLOB is over 32K, which seems to be a limitation using UTL_FILE.
    I'm running version 10.1.0.4.0.
    --=cf

    I am implementing an EDI process which requires that acknowledgments I will send back be one long text file. How can I write my CLOB to a text file without line breaks? The CLOB is over 32K, which seems to be a limitation using UTL_FILE.
    I'm running version 10.1.0.4.0.
    --=cf

  • UTL_FILE directories limitation

    Is there any limit for number of directories to be added to the UTL_FILE_DIR in init.ora. I believe oracle stores these directories in V$PARAMETER in value field which is 512 bytes. That means we cannot add directories if the total directories size exceeds 512 bytes.
    Any way to overcome this.

    Sorry, I misunderstood your question. I think that you you described yourself very well the intrinsec limitation for UTL_FILE_DIR, which is the reason for which Oracle has actuually stopped developing UTL_FILE_DIR a long time ago.
    The replacement is described in http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_file.htm#998101
    "In the past, accessible directories for the UTL_FILE functions were specified in the initialization file using the UTL_FILE_DIR parameter. However, UTL_FILE_DIR access is not recommended. It is recommended that you use the CREATE DIRECTORY feature, which replaces UTL_FILE_DIR."
    You can find many info about this in http://asktom.oracle.com.

  • Help needed in utl_file

    Hi,
    I have two groups in data model of my report. I am using utl_file in a formula column of report last group.it's working fine.
    but my problem is if customer has more than one invoice lines
    then all that lines not comes under only particular customer only at a time.
    For example my output is coming like this:
    Customer address: 3345 LIMITED-STUDIOS : 00033-45 PARR STREETLIVERPOOLCHESHIRE
    Invoice Lines: 0001000402106-JUL-07INV 10.47
    Customer address: 3345 LIMITED-STUDIOS : 00033-45 PARR STREETLIVERPOOLCHESHIRE
    Invoice Lines: 0001000402713-JUL-07INV 10.77
    But I am trying to get output like this:
    Customer address: 3345 LIMITED-STUDIOS : 00033-45 PARR STREETLIVERPOOLCHESHIRE
    Invoice Lines: 0001000402106-JUL-07INV 10.47
              0001000402713-JUL-07INV 10.77
    I am using fallowing code in my formula column:
    function CF_UTL_FILEFormula return Char is
    v_file_data utl_file.file_type;
    begin
    utl_file.put_line(v_file_data,:SEND_CUSTOMER_NAME:SEND_ADDRESS1:SEND_ADDRESS2:SEND_ADDRESS3:SEND_ADDRESS4:SEND_CITY:SEND_STATE:SEND_COUNTRY_DESC:SEND_POSTAL_CODE);
    utl_file.put_line(v_file_data,LN1:CF_LOCATION:C_DELIVERY_DATE:INVOICE_NUMBER:TRX_DATE:c_transaction_type:CD_TRX_AMOUNT);
    utl_file.fclose(v_file_data);
    end;
    Please help me how can I do this?

    What's the source of your Summary Column? It's not allowed to choose here the formula column in whcih you reference the summary column back. But another column should work.
    As alternativ add a formula column in the upper group with
    utl_file.put_line(v_file_data,:SEND_CUSTOMER_NAME:SEND_ADDRESS1:SEND_ADDRESS2:SEND_ADDRESS3:SEND_ADDRESS4:SEND_CITY:SEND_STATE:SEND_COUNTRY_DESC:SEND_POSTAL_CODE);
    and remove the same line out of the other formula column.

  • 2GB OR NOT 2GB - FILE LIMITS IN ORACLE

    제품 : ORACLE SERVER
    작성날짜 : 2002-04-11
    2GB OR NOT 2GB - FILE LIMITS IN ORACLE
    ======================================
    Introduction
    ~~~~~~~~~~~~
    This article describes "2Gb" issues. It gives information on why 2Gb
    is a magical number and outlines the issues you need to know about if
    you are considering using Oracle with files larger than 2Gb in size.
    It also
    looks at some other file related limits and issues.
    The article has a Unix bias as this is where most of the 2Gb issues
    arise but there is information relevant to other (non-unix)
    platforms.
    Articles giving port specific limits are listed in the last section.
    Topics covered include:
    Why is 2Gb a Special Number ?
    Why use 2Gb+ Datafiles ?
    Export and 2Gb
    SQL*Loader and 2Gb
    Oracle and other 2Gb issues
    Port Specific Information on "Large Files"
    Why is 2Gb a Special Number ?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Many CPU's and system call interfaces (API's) in use today use a word
    size of 32 bits. This word size imposes limits on many operations.
    In many cases the standard API's for file operations use a 32-bit signed
    word to represent both file size and current position within a file (byte
    displacement). A 'signed' 32bit word uses the top most bit as a sign
    indicator leaving only 31 bits to represent the actual value (positive or
    negative). In hexadecimal the largest positive number that can be
    represented in in 31 bits is 0x7FFFFFFF , which is +2147483647 decimal.
    This is ONE less than 2Gb.
    Files of 2Gb or more are generally known as 'large files'. As one might
    expect problems can start to surface once you try to use the number
    2147483648 or higher in a 32bit environment. To overcome this problem
    recent versions of operating systems have defined new system calls which
    typically use 64-bit addressing for file sizes and offsets. Recent Oracle
    releases make use of these new interfaces but there are a number of issues
    one should be aware of before deciding to use 'large files'.
    What does this mean when using Oracle ?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The 32bit issue affects Oracle in a number of ways. In order to use large
    files you need to have:
    1. An operating system that supports 2Gb+ files or raw devices
    2. An operating system which has an API to support I/O on 2Gb+ files
    3. A version of Oracle which uses this API
    Today most platforms support large files and have 64bit APIs for such
    files.
    Releases of Oracle from 7.3 onwards usually make use of these 64bit APIs
    but the situation is very dependent on platform, operating system version
    and the Oracle version. In some cases 'large file' support is present by
    default, while in other cases a special patch may be required.
    At the time of writing there are some tools within Oracle which have not
    been updated to use the new API's, most notably tools like EXPORT and
    SQL*LOADER, but again the exact situation is platform and version specific.
    Why use 2Gb+ Datafiles ?
    ~~~~~~~~~~~~~~~~~~~~~~~~
    In this section we will try to summarise the advantages and disadvantages
    of using "large" files / devices for Oracle datafiles:
    Advantages of files larger than 2Gb:
    On most platforms Oracle7 supports up to 1022 datafiles.
    With files < 2Gb this limits the database size to less than 2044Gb.
    This is not an issue with Oracle8 which supports many more files.
    In reality the maximum database size would be less than 2044Gb due
    to maintaining separate data in separate tablespaces. Some of these
    may be much less than 2Gb in size.
    Less files to manage for smaller databases.
    Less file handle resources required
    Disadvantages of files larger than 2Gb:
    The unit of recovery is larger. A 2Gb file may take between 15 minutes
    and 1 hour to backup / restore depending on the backup media and
    disk speeds. An 8Gb file may take 4 times as long.
    Parallelism of backup / recovery operations may be impacted.
    There may be platform specific limitations - Eg: Asynchronous IO
    operations may be serialised above the 2Gb mark.
    As handling of files above 2Gb may need patches, special configuration
    etc.. there is an increased risk involved as opposed to smaller files.
    Eg: On certain AIX releases Asynchronous IO serialises above 2Gb.
    Important points if using files >= 2Gb
    Check with the OS Vendor to determine if large files are supported
    and how to configure for them.
    Check with the OS Vendor what the maximum file size actually is.
    Check with Oracle support if any patches or limitations apply
    on your platform , OS version and Oracle version.
    Remember to check again if you are considering upgrading either
    Oracle or the OS in case any patches are required in the release
    you are moving to.
    Make sure any operating system limits are set correctly to allow
    access to large files for all users.
    Make sure any backup scripts can also cope with large files.
    Note that there is still a limit to the maximum file size you
    can use for datafiles above 2Gb in size. The exact limit depends
    on the DB_BLOCK_SIZE of the database and the platform. On most
    platforms (Unix, NT, VMS) the limit on file size is around
    4194302*DB_BLOCK_SIZE.
    Important notes generally
    Be careful when allowing files to automatically resize. It is
    sensible to always limit the MAXSIZE for AUTOEXTEND files to less
    than 2Gb if not using 'large files', and to a sensible limit
    otherwise. Note that due to <Bug:568232> it is possible to specify
    an value of MAXSIZE larger than Oracle can cope with which may
    result in internal errors after the resize occurs. (Errors
    typically include ORA-600 [3292])
    On many platforms Oracle datafiles have an additional header
    block at the start of the file so creating a file of 2Gb actually
    requires slightly more than 2Gb of disk space. On Unix platforms
    the additional header for datafiles is usually DB_BLOCK_SIZE bytes
    but may be larger when creating datafiles on raw devices.
    2Gb related Oracle Errors:
    These are a few of the errors which may occur when a 2Gb limit
    is present. They are not in any particular order.
    ORA-01119 Error in creating datafile xxxx
    ORA-27044 unable to write header block of file
    SVR4 Error: 22: Invalid argument
    ORA-19502 write error on file 'filename', blockno x (blocksize=nn)
    ORA-27070 skgfdisp: async read/write failed
    ORA-02237 invalid file size
    KCF:write/open error dba=xxxxxx block=xxxx online=xxxx file=xxxxxxxx
    file limit exceed.
    Unix error 27, EFBIG
    Export and 2Gb
    ~~~~~~~~~~~~~~
    2Gb Export File Size
    ~~~~~~~~~~~~~~~~~~~~
    At the time of writing most versions of export use the default file
    open API when creating an export file. This means that on many platforms
    it is impossible to export a file of 2Gb or larger to a file system file.
    There are several options available to overcome 2Gb file limits with
    export such as:
    - It is generally possible to write an export > 2Gb to a raw device.
    Obviously the raw device has to be large enough to fit the entire
    export into it.
    - By exporting to a named pipe (on Unix) one can compress, zip or
    split up the output.
    See: "Quick Reference to Exporting >2Gb on Unix" <Note:30528.1>
    - One can export to tape (on most platforms)
    See "Exporting to tape on Unix systems" <Note:30428.1>
    (This article also describes in detail how to export to
    a unix pipe, remote shell etc..)
    Other 2Gb Export Issues
    ~~~~~~~~~~~~~~~~~~~~~~~
    Oracle has a maximum extent size of 2Gb. Unfortunately there is a problem
    with EXPORT on many releases of Oracle such that if you export a large table
    and specify COMPRESS=Y then it is possible for the NEXT storage clause
    of the statement in the EXPORT file to contain a size above 2Gb. This
    will cause import to fail even if IGNORE=Y is specified at import time.
    This issue is reported in <Bug:708790> and is alerted in <Note:62436.1>
    An export will typically report errors like this when it hits a 2Gb
    limit:
    . . exporting table BIGEXPORT
    EXP-00015: error on row 10660 of table BIGEXPORT,
    column MYCOL, datatype 96
    EXP-00002: error in writing to export file
    EXP-00002: error in writing to export file
    EXP-00000: Export terminated unsuccessfully
    There is a secondary issue reported in <Bug:185855> which indicates that
    a full database export generates a CREATE TABLESPACE command with the
    file size specified in BYTES. If the filesize is above 2Gb this may
    cause an ORA-2237 error when attempting to create the file on IMPORT.
    This issue can be worked around be creating the tablespace prior to
    importing by specifying the file size in 'M' instead of in bytes.
    <Bug:490837> indicates a similar problem.
    Export to Tape
    ~~~~~~~~~~~~~~
    The VOLSIZE parameter for export is limited to values less that 4Gb.
    On some platforms may be only 2Gb.
    This is corrected in Oracle 8i. <Bug:490190> describes this problem.
    SQL*Loader and 2Gb
    ~~~~~~~~~~~~~~~~~~
    Typically SQL*Loader will error when it attempts to open an input
    file larger than 2Gb with an error of the form:
    SQL*Loader-500: Unable to open file (bigfile.dat)
    SVR4 Error: 79: Value too large for defined data type
    The examples in <Note:30528.1> can be modified to for use with SQL*Loader
    for large input data files.
    Oracle 8.0.6 provides large file support for discard and log files in
    SQL*Loader but the maximum input data file size still varies between
    platforms. See <Bug:948460> for details of the input file limit.
    <Bug:749600> covers the maximum discard file size.
    Oracle and other 2Gb issues
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    This sections lists miscellaneous 2Gb issues:
    - From Oracle 8.0.5 onwards 64bit releases are available on most platforms.
    An extract from the 8.0.5 README file introduces these - see <Note:62252.1>
    - DBV (the database verification file program) may not be able to scan
    datafiles larger than 2Gb reporting "DBV-100".
    This is reported in <Bug:710888>
    - "DATAFILE ... SIZE xxxxxx" clauses of SQL commands in Oracle must be
    specified in 'M' or 'K' to create files larger than 2Gb otherwise the
    error "ORA-02237: invalid file size" is reported. This is documented
    in <Bug:185855>.
    - Tablespace quotas cannot exceed 2Gb on releases before Oracle 7.3.4.
    Eg: ALTER USER <username> QUOTA 2500M ON <tablespacename>
    reports
    ORA-2187: invalid quota specification.
    This is documented in <Bug:425831>.
    The workaround is to grant users UNLIMITED TABLESPACE privilege if they
    need a quota above 2Gb.
    - Tools which spool output may error if the spool file reaches 2Gb in size.
    Eg: sqlplus spool output.
    - Certain 'core' functions in Oracle tools do not support large files -
    See <Bug:749600> which is fixed in Oracle 8.0.6 and 8.1.6.
    Note that this fix is NOT in Oracle 8.1.5 nor in any patch set.
    Even with this fix there may still be large file restrictions as not
    all code uses these 'core' functions.
    Note though that <Bug:749600> covers CORE functions - some areas of code
    may still have problems.
    Eg: CORE is not used for SQL*Loader input file I/O
    - The UTL_FILE package uses the 'core' functions mentioned above and so is
    limited by 2Gb restrictions Oracle releases which do not contain this fix.
    <Package:UTL_FILE> is a PL/SQL package which allows file IO from within
    PL/SQL.
    Port Specific Information on "Large Files"
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Below are references to information on large file support for specific
    platforms. Although every effort is made to keep the information in
    these articles up-to-date it is still advisable to carefully test any
    operation which reads or writes from / to large files:
    Platform See
    ~~~~~~~~ ~~~
    AIX (RS6000 / SP) <Note:60888.1>
    HP <Note:62407.1>
    Digital Unix <Note:62426.1>
    Sequent PTX <Note:62415.1>
    Sun Solaris <Note:62409.1>
    Windows NT Maximum 4Gb files on FAT
    Theoretical 16Tb on NTFS
    ** See <Note:67421.1> before using large files
    on NT with Oracle8
    *2 There is a problem with DBVERIFY on 8.1.6
    See <Bug:1372172>

    I'm not aware of a packaged PL/SQL solution for this in Oracle 8.1.7.3 - however it is very easy to create such a program...
    Step 1
    Write a simple Java program like the one listed:
    import java.io.File;
    public class fileCheckUtl {
    public static int fileExists(String FileName) {
    File x = new File(FileName);
    if (x.exists())
    return 1;
    else return 0;
    public static void main (String args[]) {
    fileCheckUtl f = new fileCheckUtl();
    int i;
    i = f.fileExists(args[0]);
    System.out.println(i);
    Step 2 Load this into the Oracle data using LoadJava
    loadjava -verbose -resolve -user user/pw@db fileCheckUtl.java
    The output should be something like this:
    creating : source fileCheckUtl
    loading : source fileCheckUtl
    creating : fileCheckUtl
    resolving: source fileCheckUtl
    Step 3 - Create a PL/SQL wrapper for the Java Class:
    CREATE OR REPLACE FUNCTION FILE_CHECK_UTL (file_name IN VARCHAR2) RETURN NUMBER AS
    LANGUAGE JAVA
    NAME 'fileCheckUtl.fileExists(java.lang.String) return int';
    Step 4 Test it:
    SQL> select file_check_utl('f:\myjava\fileCheckUtl.java') from dual
    2 /
    FILE_CHECK_UTL('F:\MYJAVA\FILECHECKUTL.JAVA')
    1

  • Line size in UTL_FILE

    Hi,
    Can someone please tell me what is the max. number of characters that can be written using UTL_FILE in Oracle 8.1.7?

    Perhaps I should have been more specific; I wanted to know how many characters can PUT_LINE or PUT function take at one time to write. Well, in 8.1.7, it is only 1000 characters on UNIX platform. Though it is not mentioned anywhere so I am not sure if this is OS limitation. However I had to do a lot of trial and error before e finding this out. Hope this would help people on the forum.
    Thanks guys for your help. I know I can always count on you all.
    Here is the sample code. In this, although, I had defined a buffer of 4000, but it consistently gave me 'WRITE_ERROR' for PUT_LINE or PUT function, until I reduced the buffer size used with these functions to 1000. Alternatively now I will use PUT function recursively and add NEW_LINE character after the entire buffer is read.
    declare
    vstr varchar(4000);
    file_handle UTL_FILE.FILE_TYPE;
    begin
    select rpad('Testiing',990,'xyz') into vstr from dual;
    file_handle := UTL_FILE.FOPEN ('/usr/users/cornwas/workplace', 'a.txt', 'w');
    for i in 1..20 loop
    UTL_FILE.PUT_LINE(file_handle, vstr);
    UTL_FILE.FFLUSH(file_handle);
    end loop;
    UTL_FILE.FCLOSE(file_handle);
    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_FILEHANDLE THEN
    RAISE_APPLICATION_ERROR(-20102,'Invalid Filehandle');
    WHEN UTL_FILE.INVALID_OPERATION THEN
    RAISE_APPLICATION_ERROR(-20103,'Invalid Operation -- May signal a file locked by the OS');
    WHEN UTL_FILE.READ_ERROR THEN
    RAISE_APPLICATION_ERROR(-20104,'Read Error');
    WHEN UTL_FILE.WRITE_ERROR THEN
    RAISE_APPLICATION_ERROR(-20105,'Write Error');
    WHEN UTL_FILE.INTERNAL_ERROR THEN
    RAISE_APPLICATION_ERROR(-20106,'Internal Error');
    WHEN NO_DATA_FOUND THEN
    RAISE_APPLICATION_ERROR(-20107,'No Data Found');
    WHEN VALUE_ERROR THEN
    RAISE_APPLICATION_ERROR(-20108,'Value Error');
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20109,'Unknown UTL_FILE Error');
    end;

  • UTL_FILE

    [i]Hi,
    Is there a limitation to the size of the file that can be generated by UTL_FILE package, Or the limitation of 32k is for the buffer size? In which case, the data has to be written to the output file before the limit is reached, correct?
    How to check if the buffer limit has been reached so that there is no data "loss"
    Appreciate your help....
    Thanks,
    Oracle Fan

    http://www.adp-gmbh.ch/ora/plsql/utl_file.html
    Very readable documentation.

  • Problem in writiing data to UTL_File

    Hello Friends,
    I'm using UTL_FILE to write the data into csv file, but in the table 1 description column is there which contains 3000 characters.
    My problem is i'm not able to write more than 750 characters in csv file and if i tried to do so then get the FILE_WRITE_ERROR. error msg
    I tried by breaking the column into 3 different strings by giving the column as diffrent-different aliases but facing the same problem.
    Please help me to write all the characters i.e 3000 charcters in a file.
    Is there any character length limitation in csv file?
    Regards,
    Anand

    As others have stated MAX_LINESIZE parameter of FOPEN is what matters.
    SQL> create table t(c1 varchar2(4000), c2 varchar2(4000))
      2  /
    Table created.
    SQL> insert into t values(rpad('*',4000,'*'),rpad('#',4000,'#'))
      2  /
    1 row created.
    SQL> commit
      2  /
    Commit complete.
    SQL> select length(c1), length(c2) from t
      2  /
    LENGTH(C1) LENGTH(C2)
          4000       4000
    SQL> create or replace directory utl_dir as 'e:\oracle\log_files\utl_akivanew'
      2  /
    Directory created.
    SQL> declare
      2     lFile_Handle utl_file.file_type;
      3     lc1 t.c1%type;
      4     lc2 t.c2%type;
      5  begin
      6     select c1, c2 into lc1, lc2 from t;
      7
      8     lFile_Handle := utl_file.fopen('UTL_DIR','test.csv','W', 10000);
      9
    10     utl_file.put_line(lFile_handle, lc1||','||lc2);
    11
    12     utl_file.fclose(lFile_Handle);
    13  end;
    14  /
    PL/SQL procedure successfully completed.
    SQL> declare
      2     lFile_Handle utl_file.file_type;
      3     lc1 t.c1%type;
      4     lc2 t.c2%type;
      5  begin
      6     select c1, c2 into lc1, lc2 from t;
      7
      8     lFile_Handle := utl_file.fopen('UTL_DIR','test.csv','W', 7000);
      9
    10     utl_file.put_line(lFile_handle, lc1||','||lc2);
    11
    12     utl_file.fclose(lFile_Handle);
    13  end;
    14  /
    declare
    ERROR at line 1:
    ORA-29285: file write error
    ORA-06512: at "SYS.UTL_FILE", line 69
    ORA-06512: at "SYS.UTL_FILE", line 604
    ORA-06512: at line 12

  • Utl_file raise INVALID_WRITE_ERROR

    Hi all,
    I try to use utl_file package provided by Oracle 8.1.5 to write a text file in XML format. Oracle runs in UNIX environment.
    I use the following command to open a new file:
    UTL_FILE.FOPEN(P_PATH,P_FILENAME,'w',32767);
    I use the put_line to write a line, such as
    UTL_FILE.PUT_LINE(P_FILEHANDLE,' <Font x:Family="Swiss" ss:Bold="1"/>');
    The problem is that utl_file always raises UTL_FILE.WRITE_ERROR after writting 234 lines and 8192 characters . Is there potential limition set by Oracle or Unix for the size of the written file?
    Thanks

    Hi,
    Sorry, I don't have access to Oracle 8 documentation. The following is based on Oracle 11, but I'd be surprised if it was different for earlier versions.
    There's no limit to the size of the file.
    There is a limit to the size of a line, which you're already setting by passing the fourth argument (32767) to fopen. That means you can't write more than 32767 characters in a single call to put_line, or in consecutive calls to put.
    I don't see any obvious mistakes in what you posted.
    Post a complete program that gets the same error.

  • How to extract a part of text using utl_file

    hi,
    I have a small requirement which goes as follows. I have a text file which is a resultof the sql query and it contains 16 columns as TAB delimited text . I am using the UTL_FILE package concept to read the data. In general when we use the UTL_FILE.GET_LINE we read the entire line of text. But i need to read the 10th column of the query or the tab delimited text .
    Please advice.
    My query goes something like this:
    declare
    f utl_file.file_type;
    s long;
    c number := 0;
    begin
    f := utl_file.fopen('ABC_EXTRACTS','sample1.txt','R');
    loop
    utl_file.get_line(f,s);
    insert into s values (s);
    c := c + 1;
    end loop;
    exception
    when NO_DATA_FOUND then
    utl_file.fclose(f);
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;

    prazy the one which you have specified above seems to work fine .but if a word is seperated by the space it is considering as tab (space delimited is considered as tab limited by your query)delimited .
    with T as (
    select 'john sam alfred nobel samuel thomas' col1 from dual)
    select regexp_substr(col1,'[^      ]+',1,4) from t
    here alfred nobel is a single name and is seperated by a space .the above query returns nobel but we need samuel .
    What i mean to say is space delimited should not be taken into consideration when tab delimited is considered(since if 4 is replaced by 5 in the above query we may get samuel) .
    Please advice

  • Data generation in excel format using utl_file

    Hi,
    I am exporting table data into excel files by using utl_file. But it is getting generated in the server
    directory where database is running? So, how can i get the file at client machine (As in toad or sql navigator
    we can query a table and store the data in client machine in excel format).
    What are the options:- As per my thinking
    I will have to ftp those files back to client machine using shell script?
    Is there any direct way to generate these files in client machine?
    Edited by: want_to_be_a_dba on Jan 17, 2010 1:17 AM

    want_to_be_a_dba wrote:
    But i have to give the data to clients. So I will have to take it?I understand the limitations you face, but shouldn't the data be kept in the database and let the clients use a database application to manipulate the data?
    Anyway, I think you need to test to see which methods works for you. To me it sounds like your clients need a database application, not an Excel sheet.

  • Sql loader utl_file & external table

    can any one let me know the differences between.
    1.sql loader
    2.utl_file
    3.external table
    Regards.
    Asif.

    To expand on Aron's answer....
    SQL*Loader - An operating system utility which uses control files (which you create) to load data files onto database tables.
    UTL_FILE - A database package which can be used for reading and writing files in any format you care to design programmatically.
    External Table - The latest thing which can be used instead of SQL*Loader. This is done from the database end, by creating a table as an external table and pointing it at the source file on the operating system. It also allows information similar to that put in the SQL*Loader control files to be specified against the table. By querying against the table you are in fact querying against the source file. There are some limitation compared to regular database tables such as there is no ability to write to the external table.
    ;)

  • Run RMAN using UTL_FILE

    Hi
    With regards to RMAN, Should we run the RMAN program via UTL_FILE .
    If so, please inform how to do that.
    Regards
    Kumar

    I think you are confused regarding what UTL_FILE does.
    UTL_FILE
    With the UTL_FILE package, your PL/SQL programs can read and write operating system text files. UTL_FILE provides a restricted version of operating system stream file I/O.
    UTL_FILE I/O capabilities are similar to standard operating system stream file I/O (OPEN, GET, PUT, CLOSE) capabilities, but with some limitations. For example, you call the FOPEN function to return a file handle, which you use in subsequent calls to GET_LINE or PUT to perform stream I/O to a file. When file I/O is done, you call FCLOSE to complete any output and free resources associated with the file.
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_file.htm#ARPLS069
    Clarify better what you want to do please.
    Joel Pérez
    http://otn.oracle.com/experts

  • DBMS_OUTPUT vs UTL_FILE

    In calling PL/SQL stored procedures from UNIX c-scripts, we want to write messages to the logfile defined in, and used by, the script. Will DBMS_OUTPUT get there through the UNIX re-direct or another way, or do we need to open the logfile for append with UTL_FILE? If we do this, will the c-script still be able to write to the logfile after the PL/SQL proc has run?

    UTL_FILE should be used when you want to log information to a file, DBMS_OUTPUT should be used when you want to provide feedback to an interactive user once their procedure call is done-- things like telling the user what the procedure just did. DBMS_OUTPUT writes to a limited-size buffer and cannot be read asynchronously-- you get all the messages after the code finishes. While you probably could jury-rig something where DBMS_OUTPUT calls were piped to a file, you're far better off going with UTL_FILE from the start.
    Assuming that the stored procedure has closed the file (UTL_FILE.CLOSE), the C-shell script or any other process should be able to write to the file.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Excel file UTL_FILE

    Can we read Excel file using UTL_FILE? is there a way i could read xsl file?

    user7404990 wrote:
    Can we read Excel file using UTL_FILE? is there a way i could read xsl file?In a little more detail to SY's answer...
    UTL_FILE can read text or binary files.
    An xsl file is a binary file, so yes you could read that binary data using UTL_FILE and then do what with it? store it in a BLOB column on the database maybe, but what use is that.
    I'm guessing when you say you want to read an Excel file, you want to actually get at the data in the spreadsheets, not just read the whole binary file as binary data. In that case, no, UTL_FILE cannot read the user data out of an Excel file.
    Oracle provides Heterogeneous Services (HS) to allow you to connect to other things using e.g. ODBC connectivity. Microsoft happen to provide an ODBC driver for Excel, so, you can actually set up oracle to connect to the Excel workbook as if it's a database. These are the general steps you would do to achieve that...
    1- On the Oracle database server (Windows server) Go to Control Panel>Administrative Tools>Data Sources (ODBC)>System DSN and create a data source with appropriate driver. Name it EXCL.
    2- In %ORACLE_HOME%\Network\Admin\Tnsnames.ora fie add entry:
    EXCL =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.0.24)(PORT = 1521))
        (CONNECT_DATA =
          (SID = EXCL)
        (HS = OK)
      )Here SID is the name of data source that you have just created.
    3- In %ORACLE_HOME%\Network\Admin\Listener.ora file add:
    (SID_DESC =
      (PROGRAM = hsodbc)
      (SID_NAME = <hs_sid>)
      (ORACLE_HOME = <oracle home>)
    )under SID_LIST_LISTENER like:
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = PLSExtProc)
          (ORACLE_HOME = d:\ORA9DB)
          (PROGRAM = extproc)
        (SID_DESC =
          (GLOBAL_DBNAME = ORA9DB)
          (ORACLE_HOME = d:\ORA9DB)
          (SID_NAME = ORA9DB)
        (SID_DESC =
          (PROGRAM = hsodbc)
          (SID_NAME = EXCL)
          (ORACLE_HOME = D:\ora9db)
      ) Dont forget to reload the listener
    C:\> lsnrctl reload4- In %ORACLE_HOME%\hs\admin create init<HS_SID>.ora. For our sid EXCL we create file initexcl.ora.
    In this file set following two parameters:
    HS_FDS_CONNECT_INFO = excl
    HS_FDS_TRACE_LEVEL = 05- Now connect to Oracle database and create database link with following command:
    SQL> CREATE DATABASE LINK excl
    2 USING 'excl'
    3 /
    Database link created.Now you can perform query against this database like you would for any remote database.
    SQL> SELECT table_name FROM all_tables@excl;
    TABLE_NAME
    DEPT
    EMPNote:
    1) Each worksheet in the Excel workbook is taken to be a "table" with the worksheet name being the table name (must not exceed the 30 character limit of Oracle, as Excel allows 32 chrs).
    2) The first row on the worksheet provides the column names for the table (again, limited to 30 characters)
    3) The second and subsequent rows provide the actual rows of data on the table.
    4) The above works for an Oracle server running on Windows. It's possible to set up something similar on Unix boxes, but this would require obtaining some specific odbc drivers for that particular operating system and setting them up according to that flavour of unix.
    Or refer to this Article...
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4406709207206

Maybe you are looking for

  • Zen Vision:M unusual freez

    I know there are like 0 of these a day, but I can't find any threads with my problem. Today I had to reset my ZEN Vision:M more than 0 times. It would crash halfway through a song, while scrolling through menus, when being nudged LIGHTLY or on the LO

  • Getting a sequence of Point2D objects from a PathIterator?

    I would like to be able to take an arc or some other non-straight shape and convert it's geometry into a series of points that (roughly) traverse it. I attempted the following, as an example to see how it would work:      arc = new Arc2D.Double(50,50

  • Aperture Removal & Photoshop

    I can't seem to find an answer for this. I installed the trial version of Aperture but after the expiration date I removed it because I have to wait to purchase later. Now when I open Photoshop CS3, to look for my photos through iPhoto, it is no long

  • Finder windows all open in first Spaces space

    I'm trying to use Spaces as a way to organize my cluttered desktop. I've created 12 spaces associated with various projects, and populate each one with relevant Finder windows (open folders). Everything looks great. After shutting down and restarting

  • IDVD Warning

    Hi What does the below mentioned message in >console>DiscRecording.log mean? It is iDVD version 4.0.1 and was beeing transferred via Migration Assistent from 10.3.9 to 10.4.2. I'm not using the app. at the moment and a short check didn't show any pro