您的位置:首页 > 运维架构

OGG运维优化脚本(十八)-进程操作类--全进程启停

2017-06-19 13:13 926 查看
文件: allstop.sh allstart.sh

路径 $HOME/ggscript/ggoperat
l运维OGG过程中,曾经遇到非数据同步运维同事需要配合数据库DBA维护启停所有数据同步链路的情况
因此特别编写了这两套全进程启停脚本,一套用于全进程停止,会调用长事务跳过脚本,跳过长事务,以及停止进程和MGR监控进程。一套用于全部OGG进程启动。

allstop.sh
#!/bin/bash
echo $dir
cd $HOME/ggscript/ggoperat
dir=$PWD
cd $HOME
if [ -f .profile ];then
. .profile
fi

if [ -f .bash_profile ];then
. .bash_profile
fi
cd $dir

echo "All process will be stop! Are you sure will do this job?(press any key to continue)"
select ch in "yes" "no"
do
case $ch in
"yes")
echo "execute the process stop operation"
break;
;;
"no")
echo "process break"
exit 2;
;;
*)
echo "Please select your choice :1.yes.2.no"
;;

esac
done;

cd $HOME/ggserver
(echo info all;echo exit)|./ggsci|grep "EXTRACT" |awk 'BEGIN {FS=" +"} {print $3}'|grep  '^E' >  $dir/extract
(echo info all;echo exit)|./ggsci|grep -E "EXTRACT|REPLICAT" |awk 'BEGIN {FS=" +"} {print $3}'  >  $dir/process
cd $dir
i=1
NUX=`sed -n '$=' extract`
#if [ "$i" -le "$NUX" ];then
while(($i<=$NUX));  do
ext=`sed -n $i'p' extract`
echo $ext
/bin/bash $HOME/ggscript/ggtrandata/skip.sh $ext
((i++));
done

cd $dir
i=1
NUX=`sed -n '$=' process`
echo "nux=$NUX"
cat /dev/null > $HOME/ggserver/dirdat/stop
while(($i<=$NUX));  do
ext=`sed -n $i'p' process`
echo $ext
echo "stop $ext" >> $HOME/ggserver/dirdat/stop
((i++));
done

rm -f extract
rm -f process

cd $HOME/ggserver
(echo obey dirdat/stop; echo exit)|./ggsci

(echo stop mgr;echo y;echo exit)|./ggsci


allstart.sh
#!/bin/bash
echo $dir
cd $HOME/ggscript/ggoperat

dir=$PWD
cd $HOME
if [ -f .profile ];then
. .profile
fi

if [ -f .bash_profile ];then
. .bash_profile
fi
cd $dir

cd $HOME/ggserver
(echo START mgr;echo exit)|./ggsci

(echo info all;echo exit)|./ggsci|grep "EXTRACT" |awk 'BEGIN {FS=" +"} {print $3}'  >  $dir/process
(echo info all;echo exit)|./ggsci|grep "REPLICAT" |awk 'BEGIN {FS=" +"} {print $3}' >>  $dir/process
cd $dir
i=1
NUX=`sed -n '$=' process`
while(($i<=$NUX));  do
ext=`sed -n $i'p' process`
echo $ext
/bin/bash $HOME/ggscript/ggoperat/start.sh $ext
((i++));
done
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ORACLE GOLDENGATE OGG