path : $HOME/ggscript/ggrepeat
function: This script is designed to deal with the problem that the target side repeatedly configures the source-side table, which causes data duplication on the target side. Duplicate configured table names can be checked against the process, listing specific information and the number of file rows
Source-side Duplicate table cleanup operation with note Quick note script
#!/bin/bashecho "+--------------------------------------------------------+" echo "| this script will search for the repeat table ( by RenYi) | " echo "+--------------------------------------------------------+" IF [ $# -EQ 0 ] ; then echo "Repeat extract" exit 2fibackuptime= ' date +%y%m%d-%h%m ' datenow= ' Date +%Y%m%d%H ' val =$1val= ' echo $val |tr a-z a-z ' echo "-------------------------" echo "the process name is $val "echo "-------------------------"val= ' echo $val. Prm|tr a-z a-z ' cd $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 x;x=$0;i++} ' > tempawk -F '--' ' ($ { 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 " ]doecho " no Result "exit 2donewhile [ " $i " -le " $num " ]do tal= ' sed -n $i ' P ' tmp ' echo $ talgrep -ni $TAL $HOME/ggserver/dirprm/$val ((i++));d oneecho "-------------------------"
This article is from the "Netsman" blog, make sure to keep this source http://netsman.blog.51cto.com/5750076/1939639
Ogg Operations Optimization Script (ix)-Query maintenance class--process repeating table check