[20131104]通過pipe儲存sqlplus的輸出.txt

lfree發表於2013-11-05

[20131104]通過pipe儲存sqlplus的輸出.txt

http://fritshoogland.wordpress.com/2013/10/31/compressing-sqlplus-output-using-a-pipe/

linux下通過pipe可以壓縮儲存sqlplus的輸出,減少磁碟空間的佔用。

例子:

mknod /tmp/oracle.pipe p

sqlplus -s scott/btbtms << _EOF
set escape on
set feedback off
set head off
set colsep '|'

host nohup gzip -c < /tmp/oracle.pipe > /tmp/out1.gz \&
spool /tmp/oracle.pipe
select * from emp;
spool off


_EOF

-- rm /tmp/oracle.pipe


$ less /tmp/out1.gz
      7369|SMITH     |CLERK    |      7902|1980-12-17 00:00:00|       800|          |        20
      7499|ALLEN     |SALESMAN |      7698|1981-02-20 00:00:00|      1600|       300|        30
      7521|WARD      |SALESMAN |      7698|1981-02-22 00:00:00|      1250|       500|        30
      7566|JONES     |MANAGER  |      7839|1981-04-02 00:00:00|      2975|          |        20
      7654|MARTIN    |SALESMAN |      7698|1981-09-28 00:00:00|      1250|      1400|        30
      7698|BLAKE     |MANAGER  |      7839|1981-05-01 00:00:00|      2850|          |        30
....

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-775675/,如需轉載,請註明出處,否則將追究法律責任。

相關文章