OGG运维优化脚本(十六)-信息同步类--附加日志检查-创新互联
文件名 checktrandata.sh
福州ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为
成都创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18980820575(备注:SSL证书合作)期待与您的合作!
路径$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
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
当前文章:OGG运维优化脚本(十六)-信息同步类--附加日志检查-创新互联
URL分享:
http://kswjz.com/article/ddosoe.html
扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流