文件名 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"
" > $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "user:" $usr"
" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "date:" $mydate"
" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "
" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "TABLE | " >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "PROBLEM | " >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "
" >> $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 "" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "$tab | " >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "$tmp | " >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "
" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
fi
if [ "`echo $tmp|grep disabled`" ];then
echo "" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "$tab | " >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "$tmp | " >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
echo "
" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
fi
c=`expr $c + 1`
done
i=`expr $i + 1`
done
echo "
" >> $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck
/bin/bash $HOME/ggscript/ggupload/upload.sh chk149 $HOME/ggscript/ggtablecheck/$hn-$usr.tbcheck sysinfo
本文标题:OGG运维优化脚本(十六)-信息同步类--附加日志检查
标题来源:
http://bjjierui.cn/article/geiieo.html