用大约行提取oracle表的最佳策略是什么(7700603)

时间:2015-11-17 10:29:42

标签: sql oracle

我在oracle db中有一个表,其中包含我应该用CSV提取的7700603行。注意: - 我已经完成了高达70k和80k,但7700603是大不了的。所以想有关于它的意见。

1 个答案:

答案 0 :(得分:1)

If your server is unix based go with the below approach.

#!/bin/ksh
#*======================================================================
#* Generate sql to xls report
#*-date------user------description--------------------------------------
#* 
#* Created By          Av
#*======================================================================

export ORACLE_HOME=/opt/oracle/product/1020
export PATH=$ORACLE_HOME/bin:$PATH:.
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8


cd /var/opt/powermart/data/MINA/Bin/CAR_Bowring
export MAILRECIPIENT="youremailid"

v6="`date "+%d%b%y"`"

log=/var/opt/powermart/data/MINA/Bin/CAR_Bowring/xls_export.txt
touch /var/opt/powermart/data/MINA/Bin/CAR_Bowring/xls_export.txt
chmod 777 /var/opt/powermart/data/MINA/Bin/CAR_Bowring/xls_export.txt


SQLPLUS="sqlplus -s"
LOGON="<username>/<password>@sid"


sqlblock=`$SQLPLUS -s $LOGON >> $log <<ENDOF

#set markup HTML ON
#set termout off
#set feedback off
#set pagesize 50000
#set heading on
#set sqlbl on

SET ECHO OFF
SET PAGESIZE 32766
SET LINESIZE 32766
SET NUMW 20
SET VERIFY OFF
SET TERM OFF
SET UNDERLINE OFF
SET MARKUP HTML ON
SET PREFORMAT ON
SET WORD_WRAP ON
SET WRAP ON
SET ENTMAP ON
SET SQLBL ON

spool /var/opt/powermart/data/MINA/Bin/CAR_Bowring/xls_export.xls

#Your sql query here

spool off
exit 0;
ENDOF`