您好,登錄后才能下訂單哦!
文件名 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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。