千家信息网

OGG运维优化脚本(八)- 查询维护类--批量查询

发表于:2024-11-15 作者:千家信息网编辑
千家信息网最后更新 2024年11月15日,文件名:search.sh路径:$HOME/ggscript/ggsearch功能:该脚本用于满足检查goldengate进程具体配置情况的需求而设计通过edit脚本选择调用#!/bin/bashec
千家信息网最后更新 2024年11月15日OGG运维优化脚本(八)- 查询维护类--批量查询

文件名:search.sh

路径:$HOME/ggscript/ggsearch

功能:该脚本用于满足检查goldengate进程具体配置情况的需求而设计

通过edit脚本选择调用

#!/bin/bashecho "This script is used to search the specified table!(created by renyi)"echo $dirdir=$PWD cd $HOME/ggserver#确定搜索对象类型echo "Please select the search type"echo select ch in "ALLFILE" "EXTRACT" "REPLICAT" "PUMP"docase $ch in"ALLFILE")ls -lrt $HOME/ggserver/dirprm/*.prm#获取进程清单cd $HOME/ggserver(echo info all;echo exit)|./ggscicd $dirval=1    break;;;#针对对应类型 进行搜索操作#输入需搜索的进程文件名"EXTRACT")ls -lrt $HOME/ggserver/dirprm/e*.prmcd $HOME/ggserver(echo info all;echo exit)|./ggscicd $dirread -p "Please enter the prm file name:"  valbreak;;;"REPLICAT")ls -lrt $HOME/ggserver/dirprm/r*.prmcd $HOME/ggserver(echo info all;echo exit)|./ggscicd $dirread -p "Please enter the prm file name:"  val    break;;;"PUMP")ls -lrt $HOME/ggserver/dirprm/p*.prmcd $HOME/ggserver(echo info all;echo exit)|./ggscicd $dirread -p "Please enter the prm file name:"  val break;;;   *) echo "Please select your choice : 1.ALLFILE  2.EXTRACT   3.REPLICAT  4.PUMP" ;;esacdone;echo "Please Enter the table you want to search!"read -n 1vi SearchTempi=1num=`sed -n '$=' SearchTemp`if [ "$val" == 1 ] then        while [ "$i" -le "$num" ]        do                TAL=`sed -n $i'p' SearchTemp`                grep -ni $TAL $HOME/ggserver/dirprm/* 1>> exist || echo $TAL >> notexist                 ((i++));        doneelse         while [ "$i" -le "$num" ]        do                TAL=`sed -n $i'p' SearchTemp`                grep -ni $TAL $HOME/ggserver/dirprm/$val 1>> exist || echo $TAL >> notexist                 ((i++));        donefi#输出搜索结果echo "---------------------------------------"echo "The search result is"cat existecho "---------------------------------------"echo "The not exist table is"cat notexistecho "---------------------------------------"cat SearchTemp | sort -n > SearchTempu cat notexist | sort -n > notexistu comm -23  SearchTempu  notexistu  > existablecat /dev/null > existcat /dev/null > SearchTemp cat /dev/null > notexist echo "The  exist table is"cat existableexit


0