溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

OGG運(yùn)維優(yōu)化腳本(八)- 查詢維護(hù)類(lèi)--批量查詢

發(fā)布時(shí)間:2020-06-23 00:23:50 來(lái)源:網(wǎng)絡(luò) 閱讀:783 作者:netsman1030 欄目:關(guān)系型數(shù)據(jù)庫(kù)

文件名:search.sh

路徑:$HOME/ggscript/ggsearch

功能:該腳本用于滿足檢查goldengate進(jìn)程具體配置情況的需求而設(shè)計(jì)

通過(guò)edit腳本選擇調(diào)用

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

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

#確定搜索對(duì)象類(lèi)型
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

#獲取進(jìn)程清單
cd $HOME/ggserver
(echo info all;echo exit)|./ggsci
cd $dir
val=1

    break;
;;
#針對(duì)對(duì)應(yīng)類(lèi)型 進(jìn)行搜索操作
#輸入需搜索的進(jìn)程文件名
"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

#輸出搜索結(jié)果
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


向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI