文件名: addtrandata.sh
所在路径:$HOME/ggscript/gginsert
功能:用于批量增加表附加日志,属于从加表脚本中独立出来的功能,用于应对表附加日志丢失以及加表附加日志增加失败的情况
#!/bin/bash echo "This script will add trandata( by RenYi)" ls -lrt $HOME/ggserver/dirprm/e*.prm echo "The EXTRACT process:" cd $HOME/ggserver (echo info all;echo exit)|./ggsci|grep "EXTRACT" |awk ‘BEGIN {FS=" +"} {print $3}‘|grep ‘^E‘ cd $HOME/ggscript/gginsert echo "Please press any key" read -n 1 read -p "Please enter the EXTRACT name:" val2 val=`echo $val2.PRM|tr A-Z a-z` cd $HOME/ggserver/dirprm if [ ! -e $val ]; then echo "the EXTRACT is not exist" echo "the EXTRACT is not exist" >> ‘‘$HOME‘/gglog/gginsert/InsertLog-‘$backuptime‘.log‘ exit 2 fi echo "Please Enter the table (Please enter any key)" read -n 1 cat /dev/null > trandaTmp vi trandaTmp sed ‘s/^/add trandata /‘ trandaTmp > addtrandata NUX=`sed -n ‘$=‘ addtrandata` echo $NUX i=1 echo $i cd $HOME/ggserver echo dblogin `more $HOME/ggserver/dirprm/$val|grep USERID` > dirdat/addtrandata echo $login while [ "$i" -le "$NUX" ] do sed -n "${i}p" $HOME/ggscript/gginsert/addtrandata >> dirdat/addtrandata i=`expr $i + 1` done echo OBEY dirdat/addtrandata |./ggsci
时间: 2024-10-25 03:07:37