#--------------------------------------------------------------------------
# Program :get_lockwait.sh
#Description :The script will take a snapshot of the lockwait situation.
#Usage :./get_lockwait.sh
#Date :2013-06-29
#--------------------------------------------------------------------------
Server=$(hostname)
if [ "$1" = "" ]
then echo ""
echo "Pram 1 Database name "
exit 0
else
db_name=$1
fi
export PATH=$PATH:${HOME}/sqllib/bin/
. ${HOME}/sqllib/db2profile
Datatime="`date +%Y-%m-%d-%H:%M:%S`"
echo "select 'Application - '||APPL_NAME||' is on lock wait for last 2 mins ' from sysibmadm.lockwaits where minute(current_timestamp -timestamp(LOCK_WAIT_START_TIME)) > 1 ;" > check_lockwait.sql
db2 connect to $db_name
echo "[$?]"
if [ "$?" = "0" ]
then
echo "connect database Ok" > get_lockwait.log
db2 -tvf check_lockwait.sql >> get_lockwait.log
else
echo "Error connecting to database ${db_name} at ${Datatime} " >> get_lockwait.log
fi
#rm check_lockwait.sql
如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!
赞0
添加新评论0 条评论