zoukankan      html  css  js  c++  java
  • oracle导出指定几张表的数据以逗号等为分隔符

    代码示例

    #!/bin/bash
    #====================Usage:      sh exp.sh 264  Or ./exp.sh 264   import data from records in tables which was inserted in 265 to 264 days before sysdate  ===============#
    
    if (($# == 0));then
     echo '===========you need to  input an integer parameter ============='
     exit 1
    fi
    
    echo '===========beginning of exporting data from tables==================='
    
    #prev_date
    prev_date=`date -d "-$1 day" +%Y-%m-%d`
    
    end_day=$1
    start_day=$(($1+1))
    
    export ORACLE_HOME=/u01/app/11.2.0/db_home1
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    
    #program path
    prog_path=/home/oracle/lxm/imp_exp
    
    #output file base path
    output_file_base_path=${prog_path}/file
    
    #log path
    output_log_base_path=${prog_path}/logs
    
    #db link string
    db_srv="ddjk/czty_ddjk@ddcx"
    
    
    arr=(t_sagw_callreleasepush_msg t_smb_sub_msg  t_smb_unsub_msg t_sagw_cdrpush_msg)
    
    for var in ${arr[@]};  
    do  
            output_file=${output_file_base_path}/${var}/${var}_${prev_date}".txt"
            output_log=${output_log_base_path}/${var}/${var}".log"
            echo $output_file
            if [ ! -f $output_file ];then
                    touch $output_file
            fi  
            echo $output_log
            if [ ! -f $output_log ];then
                    touch $output_log
            fi  
            sql="select * from ${var} t where t.time<sysdate-${end_day} and  t.time>=sysdate-${start_day}"
            $prog_path/sqluldr2_linux64_10204.bin user=$db_srv query="$sql" file=$output_file field=0x2c record=0x0a log=$output_log charset=ZHS16GBK txt=unl
    done
    echo '===========end of exporting data from tables==================='

    导出工具

    我是用于导出的工具的地址,你可以的点我一下
    密码:37ff

  • 相关阅读:
    资料
    CSS 折角效果
    CSS3 动画
    选择器--验证表单
    -moz 火狐 -msIE -webkit[chrome safari]
    css3 fileter始终效果 图片渲染
    jquery 库下载地址http://www.jq22.com/jquery-info122
    CSS 文字垂直居中
    图片预加载技术(存在问题,已修复)
    Round#628(div2)
  • 原文地址:https://www.cnblogs.com/yldf/p/11900100.html
Copyright © 2011-2022 走看看