天天看点

通过脚本bat导出表数据,并可限制导出记录数

脚本分为四部分:

exp_main.bat:

sqlplus scott/[email protected] @./exp_table.sql

echo userid= scott/[email protected]   > yw_exp.dat

type table_name.txt >> yw_exp.dat

type loader.txt >> yw_exp.dat

exp parfile=./yw_exp.dat

exp_table.sql:

set head off feedback off termout off

set linesize 120

set pagesize 80

spool d:/test/table_name.txt;

select 'tables=dxsq.'||tname from tab where tabtype='TABLE';

spool off;

exit;

loader.txt:

 direct=n COMPRESS=n GRANTS=y INDEXES=y ROWS=y BUFFER=419430 query="where rownum<=100" filesize=20M file=(D:/test/1.dmp,D:/test/2.dmp,D:/test/3.dmp:)log=D:/test/exp_logs.txt

紫色部分限定导出记录数.