zoukankan      html  css  js  c++  java
  • oracle spool生成文件,去掉多余的东西

    在网上找了一种方法:

    [oracle@jumper oracle]$ more sp.sql
    set heading off
    set feedback off
    set term off
    spool a.
    log
    @test.sql
    spool 
    off
    exit
    [oracle@jumper oracle]$ more test.sql
    select username from dba_users;
    [oracle@jumper oracle]$ sqlplus -S "/ as sysdba" @sp
    [oracle@jumper oracle]$ more a.log
    SYS                                                   
    SYSTEM          
    OUTLN           
    SCOTT           
    HAWA            
    CSMIG           
    TEST            
    PERFSTAT        
    MLQIN           
    EYGLE           
    DBSNMP          
    WMSYS           
    [oracle@jumper oracle]

    这种方法用SHELL包装时,如果使用下面这种形式:
    sqlplus -S "/ as sysdba" <<!
    set heading off
    set feedback off
    set term off
    spool a.log
    @test.sql
    spool off
    exit
    !
    其生成的文件还不是纯数据。只有在shell脚本中使用 sqlplus -S "/ as sysdba" @s.sql (s.sql 就是两个!之间的语句。)
    才会生成纯数据。不过这可以使用grep,awk,sed这些工具过滤掉。

  • 相关阅读:
    spring-mvc-继续学习
    springMVC学习
    spring-jdbc及事务
    Spring-MVC配置思路
    spring入门-注解的使用
    spring入门
    Spring MVC——数据校验(分组校验)
    Spring MVC——数据校验(数据回显)
    Spring MVC——数据检验步骤
    Spring MVC——参数装填方式
  • 原文地址:https://www.cnblogs.com/lee/p/604168.html
Copyright © 2011-2022 走看看