Script para monitorar e reiniciar processos do Goldengate que falharam

The below script should restart aborted GG processes. The script is capable of restarting Manager, Extract and Replicat Processes.

The logic is it just looks at info all command (of ggsci) and attempts to restart any process which it sees as not RUNNING . A non-running process can be either in STOPPED or ABORTED status.

It is intelligent enough to find out whether the stopped process is an extract, replicat or manager.

Please note I have used a script call ed /usr/local/bin/sid to set the env parameters. This script can be replaced by your own script or by setting env variables manually.

 
#!/bin/ksh . /usr/local/bin/sid xxx export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH export GG_HOME=/oracle/software/goldengate/11.1.1.1.2 export PATH=$PATH:. MSGFILE=”/tmp/mail.txt” EMAILFILE=”/tmp/email.txt” SERVERNAME=`hostname` rm -rf $EMAILFILE 2>/dev/null
cd $GG_HOME ggsci <<EOF >$MSGFILE info all exit EOF
ERROR_CTR=`cat $MSGFILE|grep -v -i “running”|wc -l`
#following loop is for manager process restart
if  [ $ERROR_CTR -ne 0 ] ; then
cat $MSGFILE|grep -v -i “running”|grep -i “manager”|while read LINE ;do
echo “Manager has aborted “>>$EMAILFILE echo “Attempting to restart” >>$EMAILFILE
cd $GG_HOME ggsci <<EOF >>$EMAILFILE start mgr info all exit EOF
done fi
#following loop is for extract process restart
if  [ $ERROR_CTR -ne 0 ] ; then
cat $MSGFILE|grep -v -i “running”|grep -i “extract”|awk ‘  {print $3 } ‘|while read LINE ;do
echo “EXTRACT $LINE has aborted “>>$EMAILFILE echo “attempting to restart” >>$EMAILFILE
cd $GG_HOME ggsci <<EOF >>$EMAILFILE start extract $LINE info all exit EOF
done fi
#following loop is for replicat process restart
if  [ $ERROR_CTR -ne 0 ] ; then
cat $MSGFILE|grep -v -i “running”|grep -i “replicat”|awk ‘  {print $3 } ‘|while read LINE ;do
echo “REPLICAT $LINE has aborted “>>$EMAILFILE echo “Attempting to restart” >>$EMAILFILE
cd $GG_HOME ggsci <<EOF >>$EMAILFILE start replicat $LINE info all exit EOF
done fi
[ -f $EMAILFILE ] && cat $EMAILFILE|mailx -s “Extract died on $SERVERNAME” gautha@xxx.xxx
 
fonte:
http://gauthamc.blogspot.com.br/2012/06/script-to-monitor-and-restart-failed.html
 
Anúncios

Sobre Alexandre Pires

ORACLE OCS Goldengate Specialist, OCE RAC 10g R2, OCP 12C, 11g, 10g , 9i e 8i - Mais de 25 anos de experiência na área de TI. Participei de projetos na G&P alocado na TOK STOK, EDINFOR alocado na TV CIDADE "NET", 3CON Alocado no PÃO DE AÇUCAR, DISCOVER alocado na VIVO, BANCO IBI e TIVIT, SPC BRASIL, UOLDIVEO alocado no CARREFOUR e atualmente na ORACLE ACS atendendo os seguintes projetos: VIVO, CLARO, TIM, CIELO, CAIXA SEGUROS, MAPFRE, PORTO SEGURO, SULAMERICA, BRADESCO SEGUROS, BANCO BRADESCO, BASA, SANTANDER, CNJ, TSE, ELETROPAULO, EDP, SKY, NATURA, ODEBRESHT, NISSEI, SICREDI, CELEPAR, TAM, TIVIT, IBM, SMILES, CELEPAR, SERPRO,OKI,BANCO PAN, etc
Esse post foi publicado em GOLDENGATE e marcado , , . Guardar link permanente.

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s