OGG operation and maintenance optimization script (9)-query maintenance class-process duplicate table check
Path: $HOME/ggscript/ggrepeat
Function: this script is designed to deal with the problem of data duplication on the target side due to the repeated configuration of the source table on the source side. You can check the repeatedly configured table name for the process and list the specific information and the number of file lines
Can cooperate with note quick comment script to clean up repetitive tables on the source side.
#! / bin/bashecho "+-+" echo "| This script will search for the repeat table (by RenYi) |" echo "+-- -+ "if [$#-eq 0] Then echo "REPEAT EXTRACT" exit 2fibackuptimetime = `date +% Y% m% dcombe% H% M`datenow = `date +% Y% m% d% H`val = $1vale = `echo $val | tr Amurz AZ-Z`echo "-" echo "The process name is $val" echo "-" val= `echo $val.PRM | tr Ashaz-z`c $HOME/ggserver/dirprmif [!-e $val] Then echo "the EXTRACT is not exist" exit 2ficd $HOME/ggscript/ggrepeatcat $HOME/ggserver/dirprm/$val | awk'/ TABLE#/,/#TABLE/ {if (I > 1) print xtincture (I > 1) tempawk-F'- -'($1) {print $1} 'temp > temp2rm-rf tempsed-e' / ^ $/ d 'temp2 > temp3rm-rf temp2awk-F','{print $1} 'temp3 > temp4rm-rf temp3awk-F' '' {print $1} 'temp4 > temp5rm-rf temp4cat temp5 | awk-F' TABLE''{print $2}'> Temprm-rf temp5sort Temp | uniq-d > $HOME/ggscript/ggrepeat/tmpecho "-" echo "The repeat table:" echo "-" cat tmpi=1num= `sed-n'$= 'tmp`echo "num= $num" echo "-" echo "The Detailed results:" echo "-" while [!-n "$num"] do echo "no result" exit 2donewhile ["$I"-le "$num"] do TAL= `sed-n $ifolp`tmp` echo $TAL Grep-ni $TAL $HOME/ggserver/dirprm/$val ((iTunes +)) Doneecho "-"