#!/bin/sh
source /etc/profile
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
YYYY=`date "+%Y"`
MM=`date "+%m"`
DD=`date "+%d"`
DEL_DAY=`date -d "10 days ago" "+%d"`
datafile1="NRMS_ZYTJJK_$YYYY$MM$DD.txt"
datafile2="NRMS_GLDJK_$YYYY$MM$DD.txt"
datafile3="NRMS_GLXQJK_$YYYY$MM$DD.txt"
datafile4="NRMS_IPRANJK_$YYYY$MM$DD.txt"
datafile5="NRMS_MSTPJK_$YYYY$MM$DD.txt"
datafile6="NRMS_DKJK_$YYYY$MM$DD.txt"
alltxt="*.txt"
daydir="$YYYY$MM$DD"
echo $datafile
basepath=$(cd `dirname $0`; pwd)
cd $basepath
rm *.txt
sqlplus -s 数据库名/passward@服务名<<EOF
set colsep','
set echo off
set feedback off
set heading off
set pagesize 0
set linesize 1000
set numwidth 20
set termout off
set timing off
set trimout on
set trimspool on
set null NULL
spool $datafile1
SELECT 'SEQ| LOCAL_NET_ID| ADDR_NAME| CABLE_NUM| FIBER_NUM| FIBER_FREE_NUM| CHAM_FIBER_NUM| CHAM_FIBER_FREE_NUM| WIRING_FLAG| MAX_BANDWIDTH| IPRAN_NUM| IPRAN_FREE_NUM| MSTP_NUM| MSTP_FREE_NUM| SYSDATE' FROM DUAL;
SELECT SEQ||'|'||LOCAL_NET_ID||'|'||ADDR_NAME||'|'||CABLE_NUM||'|'||FIBER_NUM||'|'||FIBER_FREE_NUM||'|'||CHAM_FIBER_NUM||'|'||CHAM_FIBER_FREE_NUM||'|'||WIRING_FLAG||'|'||MAX_BANDWIDTH||'|'||IPRAN_NUM||'|'||IPRAN_FREE_NUM||'|'||MSTP_NUM||'|'||MSTP_FREE_NUM||'|'||"SYSDATE"
FROM
(SELECT SEQ, LOCAL_NET_ID, ADDR_NAME, CABLE_NUM, FIBER_NUM, FIBER_FREE_NUM, CHAM_FIBER_NUM, CHAM_FIBER_FREE_NUM, WIRING_FLAG, MAX_BANDWIDTH, IPRAN_NUM, IPRAN_FREE_NUM, MSTP_NUM, MSTP_FREE_NUM, TO_CHAR (SYSDATE,'YYYY-MM-DD HH:MM:SS') "SYSDATE" FROM swly_zqzytjjk);
spool off;
EOF
ftp -inv 133.96.84.145<<EOF
user username passward
lcd $basepath
cd /data/esbftp/nmsdata/HEB/RMS
mput $alltxt
bye
EOF
网友评论