Oracle exports data with spool

Source: Internet
Author: User

Using spool to export data is sometimes a good choice, 70,000 data export needs 10s, note that the need to use @d:/spool.txt call,set Termout off will not take effect does not display to the screen. A semicolon is appended to the SQL statement and spool off.

sql> drop table test purge;
Sql> CREATE TABLE Test as SELECT * from Dba_objects;
Sql> Select COUNT (1) from test;
70483

Sql> @d:/spool.txt


Spool.txt script:

Set Feedback off
Set Heading off
Set Termout on
Set Colsep "
Set Verify off
Set echo off
Set Trimspool on
Set PageSize 1000
Set Linesize 100
Define filepath= ' D:\test.csv '
Prompt * * * spooling to &filepath
Set Termout off
Spool &filepath
SELECT * from Test;
Spool off;


Set feedback off--echo the number of record bars processed by this SQL command, default to ON
Set heading off--mask display, default on
Set termout on-remove trailing spaces per line of standard output, default to Off
Set Colsep '--field output delimiter
Set echo off-displays each SQL command in the start script, default
Set Trimspool on-remove redirect (spool) output trailing space per line, default is off
Set pagesize 1000-output per page line, default is 24, in order to avoid paging set to 0
Set Linesize 100-output one line of characters, default is 80

Oracle exports data with spool

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.