oracle sql plus后台打印 [英] oracle sql plus spool

查看:175
本文介绍了oracle sql plus后台打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用sql plus执行查询(选择),然后使用假脱机选项将结果转储到文件中. 我大约有1400万行,转储大约需要12分钟. 我想知道是否有什么可以使转储更快?

I'm using sql plus to execute a query (a select) and dump the result into a file, using spool option. I have about 14 millions lines, and it takes about 12 minutes to do the dump. I was wondering if there is something to make the dump faster?

下面是我的sql plus选项:

Here below my sql plus options:

whenever sqlerror exit sql.sqlcode
        set pagesize 0
        set linesize 410
        SET trimspool ON
        set heading on
        set feedback off
        set echo off
        set termout off
        spool file_to_dump_into.txt 
        select * from mytable;

谢谢.

推荐答案

您要串联&分隔列,还是要导出固定宽度?

Are you concatenating & delimiting your columns, or are you exporting fixed-width?

SQL * Plus脚本上查看此文档调整.特定于您的脚本,以下是几种加快脚本速度的方法:

See this documentation on SQL*Plus Script Tuning. Specific to your script, here are a few possible ways to speed it up:

  1. 确保LINESIZE尽可能小.添加您的最大列长度(如果不是固定宽度,则加上定界符).这可能会对性能产生巨大影响,因为SQL * Plus会为每个导出的行分配该内存量. 410没那么大,但是如果您可以减小它,那将会有所帮助.根据我的经验,这有很大的不同.
  2. 请勿打开TRIMSPOOL.这也会产生很大的影响.然后,将每一行填充为LINESIZE,但具有最佳的行大小,并且根据您使用文件的方式,这可能是可以接受的.但是,如果要完全消除尾随空格,通常可以更快地使用导出后的其他方法来修剪尾随空格.
  3. 玩ARRAYSIZE.这可能会有所帮助.它设置SQL * Plus的提取大小.默认值为15行.达到100可能会有所帮助,但太大则可能会降低速度.

希望这会有所帮助!

这篇关于oracle sql plus后台打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆