DB2數(shù)據(jù)庫(kù)鎖表問(wèn)題
以下的文章主要向大家介紹的是DB2數(shù)據(jù)庫(kù)鎖表問(wèn)題,在實(shí)際操作中如果中心查詢數(shù)據(jù)時(shí)要注意,如果用了交互式查詢數(shù)據(jù),命令中心將會(huì)給所查的記錄加了s鎖.這時(shí)如果要update記錄,由于update要使用x鎖,排它鎖,將會(huì)處于鎖等待.
首先,將監(jiān)視開(kāi)關(guān)打開(kāi)
- db2 update dbm cfg using dft_mon_lock on
快照
- db2 get snapshot for Locks on cleardb >snap.log
- tables
- bufferpools
- tablespaces
- database
然后再看snap.log中的內(nèi)容即可。
對(duì)Lock可根據(jù)Application handle(應(yīng)用程序句柄)看每個(gè)應(yīng)用程序的鎖的情況。
監(jiān)視完畢后,不要忘了將監(jiān)視器關(guān)閉
- db2 update dbm cfg using dft_mon_lock off
另:
- db2 update monitor switches using LOCK on
- db2 get snapshot for locks on SAMPLE
在輸出中找到 List of Locks 一節(jié),查看鎖的信息。
- select * from table( snapshot_lock ( 'loangf' , -1) ) as lock
- start database manager admin mode user ...
以上的相關(guān)內(nèi)容就是對(duì)DB2數(shù)據(jù)庫(kù)鎖表問(wèn)題的介紹,望你能有所收獲。
【編輯推薦】