文件名 checktrandata.sh
路径$HOME/ggscript/ggtrandata
该脚本的作用,是通过ogg自带的 infotrandata指令,验证EXTRACT进程内所配置表的 附加日志状态,仅针对同步oracle数据库的OGG
为了避免大批量查询影响数据库性能,如果进程内配置表信息过多。查询速度会比较慢,建议通过计划任务配置在凌晨自动运行。
#!/bin/bash cd $HOME/ggscript/ggoperat dir=$PWD cd $HOME if [ -f .profile ];then . .profile fi if [ -f .bash_profile ];then . .bash_profile fi echo "This sciprt is write by RenYi" mydate=`date +20%y-%m-%d-%H` hn=`echo $HOSTNAME` usr=`echo $USER` echo $hn-$usr echo "HOSTNAME:" $hn"<br>" > $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "user:" $usr"<br>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "date:" $mydate"<br>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "<table border="1">" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "<tr>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "<td>TABLE</td>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "<td>PROBLEM</td>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "</tr>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck cd $HOME/ggserver (echo info all;echo exit)|./ggsci|grep EXTRACT |awk 'BEGIN {FS=" +"} {print $3}'|grep ^E > $HOME/ggscript/ggtablecheck/tmp i=1 NUX=`sed -n '$=' $HOME/ggscript/ggtablecheck/tmp` #echo $NUX cd $PWD while [ "$i" -le "$NUX" ] do cat /dev/null > $HOME/ggscript/ggtablecheck/checktmp VAR=`sed -n $i'p' $HOME/ggscript/ggtablecheck/tmp` echo $VAR val=`echo $VAR.prm|tr "[:upper:]" "[:lower:]"` cat $HOME/ggserver/dirprm/$val|awk '/TABLE#/,/#TABLE/{if(i>1)print x;x=$0;i++}' > $HOME/ggscript/ggtablecheck/temp awk -F '--' '($1) { print $1}' $HOME/ggscript/ggtablecheck/temp > $HOME/ggscript/ggtablecheck/temp2 rm -rf $HOME/ggscript/ggtablecheck/temp sed -e '/^$/d' $HOME/ggscript/ggtablecheck/temp2 > $HOME/ggscript/ggtablecheck/temp3 rm -rf $HOME/ggscript/ggtablecheck/temp2 awk -F ',' '{print $1}' $HOME/ggscript/ggtablecheck/temp3 > $HOME/ggscript/ggtablecheck/temp4 rm -rf $HOME/ggscript/ggtablecheck/temp3 awk -F ';' '{print $1}' $HOME/ggscript/ggtablecheck/temp4 > $HOME/ggscript/ggtablecheck/temp5 rm -rf $HOME/ggscript/ggtablecheck/temp4 cat $HOME/ggscript/ggtablecheck/temp5|awk -F 'TABLE ' '{print $2}' > $HOME/ggscript/ggtablecheck/Temp rm -rf $HOME/ggscript/ggtablecheck/temp5 sed '/^$/d' $HOME/ggscript/ggtablecheck/Temp > $HOME/ggscript/ggtablecheck/temp rm -rf $HOME/ggscript/ggtablecheck/Temp a=1 NUM=`sed -n '$=' $HOME/ggscript/ggtablecheck/temp` echo $NUM while [ "$a" -le "$NUM" ] do table=`sed -n $a'p' $HOME/ggscript/ggtablecheck/temp` echo dblogin `more $HOME/ggserver/dirprm/$val|grep USERID` > $HOME/ggserver/dirdat/checktrandata echo "info trandata $table" >> $HOME/ggserver/dirdat/checktrandata (echo OBEY dirdat/checktrandata;echo exit) |./ggsci >> $HOME/ggscript/ggtablecheck/checktmp sleep 1 a=`expr $a + 1` done cat $HOME/ggscript/ggtablecheck/checktmp|grep table > $HOME/ggscript/ggtablecheck/checkresult1 sed '/supplementally/d' $HOME/ggscript/ggtablecheck/checkresult1 > $HOME/ggscript/ggtablecheck/resulttmp cat $HOME/ggscript/ggtablecheck/resulttmp > $HOME/ggscript/ggtablecheck/checkresult c=1 NUN=`sed -n '$=' $HOME/ggscript/ggtablecheck/checkresult` cat /dev/null > $HOME/ggscript/ggtablecheck/table cat /dev/null > $HOME/ggscript/ggtablecheck/event while [ "$c" -le "$NUN" ] do tmp=`sed -n $c'p' $HOME/ggscript/ggtablecheck/checkresult` tab=`sed -n $c'p' $HOME/ggscript/ggtablecheck/temp` if [ "`echo $tmp|grep ERROR`" ];then echo "<tr>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "<td>$tab</td>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "<td>$tmp</td>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "</tr>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck fi if [ "`echo $tmp|grep disabled`" ];then echo "<tr>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "<td>$tab</td>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "<td>$tmp</td>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck echo "</tr>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck fi c=`expr $c + 1` done i=`expr $i + 1` done echo "</table>" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck /bin/bash $HOME/ggscript/ggupload/upload.sh chk149 $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck sysinfo
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。