OGG运维优化脚本(八)- 查询维护类--批量查询
admin
2023-04-26 23:59:55
0

文件名:search.sh

路径:$HOME/ggscript/ggsearch

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

通过edit脚本选择调用

#!/bin/bash
echo "This script is used to search the specified table!(created by renyi)"

echo $dir
dir=$PWD 
cd $HOME/ggserver

#确定搜索对象类型
echo "Please select the search type"
echo 

select ch in "ALLFILE" "EXTRACT" "REPLICAT" "PUMP"
do
case $ch in
"ALLFILE")
ls -lrt $HOME/ggserver/dirprm/*.prm

#获取进程清单
cd $HOME/ggserver
(echo info all;echo exit)|./ggsci
cd $dir
val=1

    break;
;;
#针对对应类型 进行搜索操作
#输入需搜索的进程文件名
"EXTRACT")
ls -lrt $HOME/ggserver/dirprm/e*.prm
cd $HOME/ggserver
(echo info all;echo exit)|./ggsci
cd $dir



read -p "Please enter the prm file name:"  val
break;
;;


"REPLICAT")
ls -lrt $HOME/ggserver/dirprm/r*.prm
cd $HOME/ggserver
(echo info all;echo exit)|./ggsci
cd $dir
read -p "Please enter the prm file name:"  val
    break;
;;

"PUMP")
ls -lrt $HOME/ggserver/dirprm/p*.prm
cd $HOME/ggserver
(echo info all;echo exit)|./ggsci
cd $dir
read -p "Please enter the prm file name:"  val
 break;
;;
   
*)
 echo "Please select your choice : 1.ALLFILE  2.EXTRACT   3.REPLICAT  4.PUMP"
 ;;
esac
done;


echo "Please Enter the table you want to search!"
read -n 1
vi SearchTemp





i=1
num=`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++));
	done
else 
	while [ "$i" -le "$num" ]
	do
		TAL=`sed -n $i'p' SearchTemp`
		grep -ni $TAL $HOME/ggserver/dirprm/$val 1>> exist || echo $TAL >> notexist
		 ((i++));
	done
fi

#输出搜索结果
echo "---------------------------------------"
echo "The search result is"
cat exist
echo "---------------------------------------"
echo "The not exist table is"
cat notexist
echo "---------------------------------------"

cat SearchTemp | sort -n > SearchTempu 
cat notexist | sort -n > notexistu 
comm -23  SearchTempu  notexistu  > existable
cat /dev/null > exist
cat /dev/null > SearchTemp 
cat /dev/null > notexist 
echo "The  exist table is"
cat existable
exit


相关内容

热门资讯

卖“毒蛋”的人,抓到了 作者 | 何国胜 编辑 | 向现“(人)抓到了,目前案件正在侦办中。”7月28日晚间,苏州禁毒部门有...
尺素金声丨实施零关税国家达63... 海关总署发布的数据显示,今年5月1日起,我国对53个非洲建交国全面实施零关税举措,目前,我国实施零关...
职业索赔盯上基层诊所,倒逼用药... 文 | 布丁基层诊所正在被职业索赔盯上。据新京报,去年夏天,一男子走进河南南阳一家诊所,要求购买三瓶...
“西瓜我全买了”就可以肆意妄为... 拿西瓜砸了人,把瓜都买了,就能一走了之吗?事实证明,这套逻辑在法治社会行不通。7月28日晚,据海峡都...
科学家在日本广岛发现新物质,系... 在美国对日本广岛进行原子弹轰炸近81年后,科学家们在广岛的沙滩上发现了一种奇异且从未被发现过的新物质...
AI失控,反噬开始 作者 | 贺一 编辑 | 阿树近期,中国开源模型在美国频繁引发热议。7月28日,月之暗面发布Kimi...
“总统千金天价离婚”,分到43... 2026年7月24日下午,首尔高等法院,一场持续近十年的司法拉锯战终于接近尾声。法庭裁定SK集团会长...
巴基斯坦,又拿下一个历史性协议 全世界都没想到,接连的中东大战,巴基斯坦正成为最大赢家。去年以色列追杀哈马斯,空袭卡塔尔首都,阿拉伯...
汇正财经贺峰的一对一指导服务怎...   对于考虑购买证券投资顾问服务的投资者来说,'一对一指导服务怎么样'是一个重要的考量维度。需要首先...
重庆失联00后网格员龚宝冬确认...   重庆失联00后网格员龚宝冬确认遇难  【重庆失联00后网格员龚宝冬确认遇难】2026年7月29日...