自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

DB2數(shù)據(jù)庫(kù)解死鎖之shell腳本經(jīng)典版!

數(shù)據(jù)庫(kù)
我們今天主要向大家講述的是在linux/unix下,DB2數(shù)據(jù)庫(kù)解死鎖之shell腳本,以及對(duì)其在實(shí)際操作中要用到的實(shí)際操作代碼的描述。

以下的文章主要向大家描述的是在linux/unix下,DB2數(shù)據(jù)庫(kù)解死鎖之shell腳本,以下就是對(duì)在linux/unix下,DB2數(shù)據(jù)庫(kù)解死鎖之shell腳本的具體描述,希望在你今后的學(xué)習(xí)中會(huì)有所幫助。

clear;

  1. DB2 "connect to db user dbuser using dbpass"  
  2. DB2 "update monitor switches using lock on table on"  
  3. tmpf=`echo "$HOME/tmp/""$RANDOM"_"$SECONDS"".lock"`  
  4. DB2 get snapshot for locks on abbs>$tmpf  
  5. handles=`cat $tmpf|awk '{if($2=="handle")print $4}'`  
  6. x=0;  
  7. y=0;  
  8. deadhandles=" " 
  9. for i in $handles  
  10. do  
  11.  

取當(dāng)前id所在行

  1. ibeg=`cat $tmpf|awk '{if($2=="handle" && $4=="'$i'")print NR}'`;  
  2. #echo "Line[15]:handle:$i,beg:$ibeg" 

取當(dāng)前行以后的內(nèi)容

 

  1. cat $tmpf|awk '{if(NR-1>'$ibeg')printf("%s\n", $0);}'>$tmpf.$i; 

取下一個(gè)handle所在行

 

  1. hangdleaf=`cat $tmpf.$i|awk '{if($2=="handle")print NR}'`  
  2. #echo Line[20]:$hangdleaf  
  3. if [ -z "$hangdleaf" ];then  
  4. cat $tmpf.$i>$tmpf.$i.aft;  
  5. else 

取下一個(gè)handle

 

  1. itmp="";  
  2. for j in $hangdleaf  
  3. do  
  4. if [ -z "$itmp" ];then  
  5. handlenext=$j;  
  6. itmp="get done!" 
  7. fi  
  8. done  
  9. #echo Line[33]:$handlenext;  
  10. #cat $tmpf.$i|awk '{if(NR<'$handlenext')print $0;}'  
  11. cat $tmpf.$i|awk '{if(NR<'$handlenext')print $0;}'>$tmpf.$i.aft;  
  12. fi 

判斷本handle相關(guān)的鎖 是否存在排他鎖

  1. ifx=`cat $tmpf.$i.aft|awk '{if(($1=="Mode" && ($3=="X" || $3=="IX")) ||($2=="mode" && substr($6,2,1)=="X") )print $0;}'`  
  2. #echo Line[39]:handle[$i],$ifx  
  3. if [ -z "$ifx" ];then  
  4. a=1 
  5. else  
  6. deadhandles="$deadhandles"" $i" 
  7. x=`expr $x + 1`;  
  8. echo $i  
  9. fi  
  10. #cat $tmpf.$i.aft|grep X|more  
  11. #echo Line[48]:$deadhandles  
  12. #read yn  
  13. rm -f $tmpf.$i  
  14. rm -f $tmpf.$i.aft  
  15. done  
  16. #echo "死鎖$x:$deadhandles";  
  17. #read yn  
  18. clear  
  19. if [ -z "$deadhandles" ] || [ "$deadhandles" = " " ] ;then  
  20. echo "沒(méi)有死鎖,退出......";  
  21. read yn;  
  22. exit 0;  
  23. fi  
  24. echo "鎖句柄:$deadhandles,解鎖? Y/N\c"  
  25. read yn;  
  26. if [ -z "$yn" ];then  
  27. echo "放棄解鎖!"  
  28. exit 0;  
  29. fi  
  30. if [ "$yn" = "Y" ] || [ "$yn" = "y" ];then  
  31. x=0;  
  32. for i in $deadhandles  
  33. do  
  34. echo 解死鎖:$i  
  35. DB2 "force applications($i)"  
  36. x=`expr $x + 1`  
  37. done  
  38. echo "解開(kāi)[$x]個(gè)鎖...."   
  39. else  
  40. echo "放棄解鎖!"  
  41. exit 0;  
  42. fi  
  43. DB2 connect reset;  
  44. DB2 terminate;  
  45. rm -f $tmpf  
  46. echo "解鎖終端:">/tmp/tty.tmp  
  47. tty>>/tmp/tty.tmp  
  48. wall </tmp/tty.tmp  
  49. rm -f /tmp/tty.tmp  

以上的相關(guān)內(nèi)容就是對(duì)linux/unix下DB2數(shù)據(jù)庫(kù)解死鎖的shell腳本的介紹,望你能有所收獲。

【編輯推薦】

  1. DB2 CMO安裝7.1.2.6補(bǔ)丁之后會(huì)出現(xiàn)的錯(cuò)誤
  2. IBM DB2數(shù)據(jù)庫(kù)新手必看的基礎(chǔ)知識(shí)有哪些?
  3. 如何正確管理DB2 For z/OS or OS/390的操作性能
  4. 安裝DB2 Content Manager8.3出現(xiàn)144錯(cuò)誤代碼
  5. 安裝IBM DB2 Content Manager V83時(shí)與122錯(cuò)誤代碼

     

     
責(zé)任編輯:佚名 來(lái)源: 51CTO.com
相關(guān)推薦

2010-08-12 09:33:30

DB2數(shù)據(jù)庫(kù)備份

2010-08-09 16:51:24

DB2數(shù)據(jù)庫(kù)

2010-09-06 12:44:24

DB2數(shù)據(jù)庫(kù)

2010-08-17 17:29:06

DB2性能優(yōu)化

2010-08-27 11:28:39

DB2shell數(shù)據(jù)庫(kù)

2010-08-13 10:43:49

IBM DB2數(shù)據(jù)庫(kù)

2010-08-25 10:50:48

DB2數(shù)據(jù)庫(kù)

2011-03-11 16:02:03

DB2數(shù)據(jù)庫(kù)安裝

2009-06-25 10:30:30

2010-08-26 16:15:25

DB2數(shù)據(jù)庫(kù)管理

2010-11-01 11:30:41

DB2數(shù)據(jù)庫(kù)權(quán)限

2010-09-30 11:49:21

DB2數(shù)據(jù)庫(kù)權(quán)限

2010-11-03 16:21:18

DB2數(shù)據(jù)庫(kù)授權(quán)

2011-03-16 16:03:00

DB2數(shù)據(jù)庫(kù)

2010-08-26 10:37:40

DB2Q復(fù)制

2010-08-19 11:33:43

DB2常用函數(shù)

2010-07-30 14:14:11

DB2快照函數(shù)

2010-09-06 16:36:20

DB2快照函數(shù)

2010-08-20 12:49:49

DB2 pureXML

2009-07-06 17:34:26

遠(yuǎn)程復(fù)制DB2
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)