判断导出是否成功

export ORACLE_BASE=/u/oracle/

 

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_2

 

export ORACLE_SID=orcl

 

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

 

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

 

export LC_CTYPE=en_US.UTF-8

 

exp mnsh/mnsh@lt211 file=/data/bakper30min.dat tables=\(curord\) log=/data/bakper30minExp.log

 

#read the last 2 line of file

new=`tail -n 2 /data/bakper30minExp.log`#读取导出的log的最后2行

echo $abc

#read the last 2 line of file

success=`tail -n 2 /data/bakper30minExpSuccess.log`#读取导出成功log的最后2行(成功备份的log)

echo $test

if [ "$new" == "$success" ];then#对比2个是否相等,一般如果出错倒数第2行是错误信息

        echo "Exp success"

        sqlplus mnshbak/mnshbak@orcl @/u/dropPer30min.sql

        imp mnshbak/mnshbak@orcl file=/data/bakper30min.dat fromuser=mnsh touser=mnshbak log=/data/bakper30minImp.log

else

        echo "Exp fail"

fi


你可能感兴趣的:(oracle,sql)