定时删除历史文件

deldata.sh

#oracle 10gr2
export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/products/10.2/db
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export ORACLE_OWNER=ZJWH02
export ORACLE_SID=zjboss
export ORACLE_TERM=xterm
export LD_LIBRARY_PATH=/oracle/products/10.2/db/lib:$LD_LIBRARY_PATH
export PATH=/oracle/products/10.2/db/bin:$PATH
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

PASS=`cat /home/zjlzw/lzw/pass_chg.etc`
cd /home/zjlzw/lzw

sqlplus $PASS <<!
spool tp_date
select to_char(sysdate-3,'YYYYMMDD') from dual;
spool off;
exit
!

DT=`cat tp_date.lst|grep 20 | awk -F" " '{print $1}'`
echo $DT

rm *$DT*
sqlplus $PASS <<!
spool tp_date
select to_char(sysdate-1,'YYYYMMDD') from dual;
spool off;
exit
!
DT=`cat tp_date.lst|grep 20 | awk -F" " '{print $1}'`
/home/zjlzw/lzw/qqtxinkaihu_new.sh $DT

你可能感兴趣的:(文件)