Export large Oracle data as text files

Source: Internet
Author: User
To export some data from Oracle to a text file (flatfile), due to the large data table, the export fails when toad is used. In fact, the memory overflow occurs. It seems that Oracle's own life is still used

To export some data from Oracle to a text file (flatfile), due to the large data table, the export fails when toad is used. In fact, the memory overflow occurs. It seems that Oracle's own life is still used

To export some data from Oracle to a text file (flatfile), due to the large data table, the export fails when toad is used. In fact, the memory overflow occurs. It seems that we should use Oracle's own command to complete it.

First, prepare the exported directory. Assume It is/opt/tmp. This directory requires the Oracle account to be able to read and write.
Create or replace directory utlexportpath as '/opt/tmp ';

Then, you can use the following method to export the file in sqlplus:

Declare
Outfile utl_file.file_type;
Begin
Outfile: = utl_file.fopen ('UTLEXPORTPATH', 'Exp.txt', 'w ');
For rec in (select col1, col2 from sometable where your conditions)
Loop
Utl_file.put_line (outfile, rec. col1 | ',' | rec. col2 );
End loop;
Utl_file.fclose (f );
End;

Even the data on G can be exported very quickly.
Try it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.