Chinaunix首页 | 论坛 | 博客
  • 博客访问: 841384
  • 博文数量: 150
  • 博客积分: 5123
  • 博客等级: 大校
  • 技术积分: 1478
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-06 10:03
文章分类

全部博文(150)

文章存档

2011年(2)

2010年(139)

2009年(9)

分类: Oracle

2010-08-31 17:35:11

此脚本的特点为,只连接数据库一次,并不会每次要执行SQL时都连接数据库一次,所以这可以做到秒级的循环,同时如果连接异常中断还会自动重连:


#!/usr/bin/ksh



currpath=/home/oracle/scripts
while [ 1 -eq 1 ]
do
    echo spool ${currpath}/refresh.spool
    echo "execute p_refresh_mv()"
    echo spool off
    sleep 2
    errcnt=`cat ${currpath}/refresh.spool|grep ORA-01012|grep -v grep |wc -l`
    >${currpath}/refresh.spool
    if [ "${errcnt}" -gt 0 ];then
        echo connect csc/WxQcSbFbF9
    else
        sleep 50
    fi
done | sqlplus "csc/xxxxxx"


阅读(2090) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~