執行 SQL 語句時,出現相似以下錯誤消息。html
指令 SQL:insert into t_stat_file_temp
SQLSTATE:57011,供應商錯誤代碼:-964
DB2 SQL 錯誤:SQLCODE:-964,SQLSTATE:57011,
SQLERRMC:空sql
數據庫堆中沒有足夠的存儲空間可用於處理該語句,此錯誤消息是事務日誌中耗盡空間的結果。shell
經過相似以下語句調整主日誌文件數,以及輔助日誌文件數。
例如:分配八個主日誌文件,同時最多分配 100 個輔助日誌文件。注意:輔助日誌文件將根據須要進行分配,並在不須要時刪除。數據庫
db2 update db cfg for $DBNAME using logprimary 8 db2 update db cfg for $DBNAME using logsecond 100
若是出現因事務異常致使事務日誌存儲空間不足的狀況,則單純擴展存儲空間每每難以完全解決問題,所以須要本方式提供了完全排查的步驟。
注意:如下操做均在 db2 connect to $DBNAME
鏈接至數據庫後執行。app
經過以下語句,查看各節點的日誌空間使用狀況,定位事務日誌空間使用率(LOG_UTILIZATION_PERCENT)太高的節點。ide
db2 " select DB_NAME, LOG_UTILIZATION_PERCENT, TOTAL_LOG_USED_KB,TOTAL_LOG_AVAILABLE_KB,TOTAL_LOG_USED_TOP_KB, DBPARTITIONNUM from SYSIBMADM.LOG_UTILIZATION order by DBPARTITIONNUM "
執行結果相似以下。
ui
在事務日誌空間使用率太高的節點上,執行以下命令,定位是否存在事務日誌使用量(UOW_LOG_SPACE_USED)太高的活動鏈接。this
db2 "select APPLICATION_HANDLE,UOW_LOG_SPACE_USED,UOW_START_TIME from TABLE(MON_GET_UNIT_OF_WORK(NULL,-1)) order by UOW_LOG_SPACE_USED"
若存在異常的活動鏈接,則能夠經過相似以下命令終止。spa
db2 "force application (h1 [,h2,..hn])"
h1 [,h2,..hn] 表明 application handle identifier3d
在事務日誌空間使用率太高的節點上,執行以下命令,以交互模式定位是否存在不肯定事務(In-doubt transaction)。
db2 list indoubt transactions with prompting
若存在不肯定事務,則能夠經過交互命令進行 COMMIT 或 ROLLBACK 等操做,具體操做參見 WITH PROMPTING 模式的說明。
Command parameters WITH PROMPTING Indicates that indoubt transactions are to be processed. If this parameter is specified, an interactive dialog mode is initiated, permitting the user to commit, roll back, or forget indoubt transactions. If this parameter is not specified, indoubt transactions are written to the standard output device, and the interactive dialog mode is not initiated.
Interactive dialog mode permits the user to:
- List all indoubt transactions (enter l)
- List indoubt transaction number x (enter l, followed by a valid transaction number)
- Quit (enter q)
- Commit transaction number x (enter c, followed by a valid transaction number)
- Roll back transaction number x (enter r, followed by a valid transaction number)
- Forget transaction number x (enter f, followed by a valid transaction number).
A blank space must separate the command letter from its argument.