In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
File name: skiptrans.sh skip.sh
Path: $HOME/ggscript/ggtrandata
Function: this script is used to restart the extraction process to skip long transactions, and can automatically identify long transactions for more than 1 hour and skip them in batches. Skiptrans.sh is selected to call through the edit script, and skip.sh is used to call in other scripts, such as allstop.sh full goldengate process stop script.
Ps: currently, this script is only available for AIX and LINUX systems
Skiptrans.sh
#! / the function of converting bin/bash# time into seconds, refer to the script function date2seconds {echo "$*" | awk'{z=int (14Muzap2) / 12); Yoshiyama 1: 4800; j=int ((153*m+2) / 5) + $3+y*365+int (yhand 4)-int (yhand 100) + int (yhand 400)-2472633 J=j*86400+$4*3600+$5*60+$6 print j}'} cd $HOME/ggscript/ggtrandataecho $loginecho $dirdir=$PWD echo $dircd $HOME/ggserver# enter the process name echo "searching the Extract name." (echo info all) that needs to skip long transactions Echo exit) |. / ggsci | grep "EXTRACT" | awk 'BEGIN {FS= "+"} {print $3}' | grep'^ E'read-p "Please enter the extract name:" extract# gets the showtrans long transaction echo "loading the trans data.please wait." (echo send $extract showtrans thread1; echo exit) of 2 threads |. / ggsci > $dir/thread1echo "Thread 1 data load compete" (echo send $extract showtrans thread 2) Echo exit) |. / ggsci > $dir/thread2echo "Thread 2 data load compete" cd $dir# divides long transaction information into two parts: time and trans number cat thread1 | awk 'BEGIN {} {FS= "} / ^ XID:/ {print $2}' | sed-e'/ ^ $/ d'> xid1cat thread1 | awk-F 'Time:' {print $2}'| sed-e'/ ^ $/ d' > time1paste time1 xid1 > trandatacat thread2 | awk 'BEGIN {} {FS="} " / ^ XID:/ {print $2}'| sed-e'/ ^ $/ d'> xid2cat thread2 | awk-F 'Time:' {print $2}'| sed-e'/ ^ $/ d'> time2paste time2 xid2 > trandata2cat trandata2 > > trandata# conversion time through function And exclude long transactions within one hour sydate= `date + "% Y-%m-%d:%H:%M:%S" `echo $HSYSTIMEdate2seconds `echo $sydate | sed's Universe / / g SecondssysHSYSTIME= secondssysHSYSTIME= `cat secondssys`echo $HSYSTIMErm-f secondssys#date2seconds `Universe $sydate | sed's Universe / g SecondssysHGTI= secondssysHGTI= `cat secondssys`rm-f secondssysecho $HGTIecho $HSYSTIMEPOOR= `expr $HSYSTIME-3600`echo $POORecho "-" if ["$HGTI"-le "$POOR"] then sed-n "{I} p" trandata | awk'{print $2}'> > trainsfii= `expr $I + 1`done # combine long transactions from an hour ago into skiptrans instructions And batch execute sed's / ^ / send'$extract' skiptrans / 'trains > trains1sed's HOME/ggscript/ggtrandata/skiptrains / force/' trains1 > skiptrains cd $HOME/ggservercat $HOME/ggscript/ggtrandata/skiptrains > dirdat/skiptrainsecho OBEY dirdat/skiptrains |. / ggsci
Skip.sh
#! / bin/bashecho $dircd $HOME/ggscript/ggtrandatadir=$PWDcd $HOMEif [- f. Profile]; then. Profilefiif [- f. Bash _ profile]; then. .bash _ profileficd $dirfunction date2seconds {echo "$*" | awk'{z=int (14Muxue 2) / 12); j=j*86400+$4*3600+$5*60+$6 print j}'} if [$#-eq 0] [$#-eq 0] Then echo "skip EXTRACT" exit 2fiextract=$1if [`echo $extract | grep ^ E`]; then IType=EXTRACTelif [`echo $extract | grep ^ P`]; then echo "only can operate the EXTRACT process" exit 2elif [`echo $extract | grep ^ R`]; then echo "only can operate the extract process" exit 2else echo "only can operate the EXTRACT process" exit 2fival`echo $extract.PRM | tr Amura-z`cd $HOME/ggserver/dirprmif [!-e $val] Then echo "the EXTRACT is not exist" exit 2ficd $direcho $loginecho $dircd $HOME/ggserverecho "loading the trans data.please wait." (echo send $extract showtrans thread1; echo exit) |. / ggsci > $dir/thread1echo "Thread 1 data load compete" (echo send $extract showtrans thread 2 Echo exit) |. / ggsci > $dir/thread2echo "Thread 2 data load compete" cd $dircat thread1 | awk 'BEGIN {} {FS= "} / ^ XID:/ {print $2}' | sed-e'/ ^ $/ d'> xid1cat thread1 | awk-F 'Time:' {print $2}'| sed-e'/ ^ $/ d'> time1paste time1 xid1 > trandatacat thread2 | awk 'BEGIN {} {FS="} / ^ XID:/ {print $2}' | sed-e'/ ^ $/ d' | > xid2cat thread2 | awk-F 'Time:' {print $2}'| sed-e'/ ^ $/ d' > time2paste time2 xid2 > trandata2cat trandata2 > > trandatasydate= `date + "% Y-%m-%d:%H:%M:%S" `echo $HSYSTIMEdate2seconds `echo $sydate | sed's echo / g SecondssysHSYSTIME= secondssysHSYSTIME= `cat secondssys`echo $HSYSTIMErm-f secondssys#date2seconds `Universe $sydate | sed's Universe / g SecondssysHGTI= secondssysHGTI= `cat secondssys`rm-f secondssysecho $HGTIecho $HSYSTIMEPOOR= `expr $HSYSTIME-3600`echo $POORecho "-" if ["$HGTI"-le "$POOR"] then sed-n "{I} p" trandata | awk'{print $2}'> > trainsfii= `expr $I + 1`donesed 's / ^ / send'$extract' skiptrans / 'trains > trains1sed's HOME/ggscript/ggtrandata/skiptrains / force/' trains1 > skiptrains cd $HOME/ggservercat $HOME/ggscript/ggtrandata/skiptrains > dirdat/skiptrainsecho OBEY dirdat/skiptrains |. / ggsci
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.