db2表空間被鎖的解決方法
如果遇到db2表空間被鎖,重啟數(shù)據(jù)庫, 無效,怎么辦呢?下文就為您介紹db2表空間被鎖的解決方法,如果您遇到過db2表空間被鎖的問題,不妨一看。
錯誤代碼是
Table space access is not allowed. SQLSTATE=55039
force application all
db2stop
db2start
>;db2 "list tablespace containers for 2 show detail"|pg
Tablespace Containers for Tablespace 2
Container ID = 0
Name = /dev/rhisdb01
Type = Disk
Total pages = 5242880
Useable pages = 5242848
Accessible = Yes
容器是正常的阿
正常表空間狀態(tài)是
State = 0x0000
Detailed explanation:
Normal
現(xiàn)在表空間狀態(tài)是
Tablespace ID = 4
Name = ff
Type = Database managed space
Contents = Any data
State = 0x0004
Detailed explanation:
Quiesced: EXCLUSIVE
如何解除這種狀態(tài)
Enter db2 "list tablespaces show detail".
Find the tablespace id and object id that have the tablespace in this state.
Look at the system catalog table syscat.tables to determine to which table the object id refers.
Reissue the load with the replace or restart option against this table.
編碼時死鎖是很常見的事情,沒有理由去指責程序員的疏忽,死鎖后及時的排除死鎖才是最重要的。我的問題已經得到解決,方法是利用第三方工具對掛起的表空間中的所有表進行quiesce reset,另外謝謝anto的指點
,但不知"Find the tablespace id and object id that have the tablespace in this state"中object id 是指什么?怎么查找?
object id just like this
'表空間標識 = 0'
應該是吧![/quote]
tablespace id 應該是表空間標識的id,而object id應該是造成死鎖表的id,然后可以通過 select tabname from syscat.tables where tableid=object id,來得到表的名稱,最后用quiesce tablespaces for table tablename reset語句來清除這樣狀態(tài)。
經過驗證已找到答案如下
Number of quiescers = 1
Quiescer 1:
Tablespace ID = 2
Object ID = 3338
朋友們,為了不要deallock,請千萬不要在 Commit & Rollback 前放 MessageBox
【編輯推薦】