天天看點

Replication:The transaction log for database 'tempdb' is full due to 'ACTIVE_TRANSACTION'

今天早上,Dev跟我說,執行query statement時出現一個error,detail info是:

“The transaction log for database 'tempdb' is full due to 'ACTIVE_TRANSACTION'”

錯誤資訊提示:由于活動事務太長,使得 tempdb 的 transaction log file 空間用盡。

一般情況下,由于tempdb 的 Recovery Mode是 simple,日志檔案會自動截斷和重用,如果活動事務太長,或短時間内事務日志太多,導緻事務日志不能及時截斷和重用,會出現log file 空間不足的問題。檢查tempdb的日志file的設定:最大值,自動增長和Disk 剩餘可用空間,保證 tempdb的 log file 有足夠的Disk空間。

如果不是日志File設定的問題,那可能是tempdb的資料檔案(mdf 或ndf)空間不足。檢視Sql server的ErrorLog,發現錯誤資訊:

"Could not allocate space for object 'dbo.TempTable_xxxx' in database 'db_yyyy' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup."

解決方案:

為tempdb 增加 File 或增加現有file的最大值,建議将 tempdb 的 files 存放在不同的Disk上,并且 files 的數量接近于或等于 CPU 數量,這樣能夠減少 PageLatch 和 PageIOLatch 等待。

參考文檔:

Sql Server Error Messages : The transaction log for database ‘tempdb’ is full due to ‘ACTIVE_TRANSACTION’

作者

:悅光陰

出處

:http://www.cnblogs.com/ljhdo/

本文版權歸作者和部落格園所有,歡迎轉載,但未經作者同意,必須保留此段聲明,且在文章頁面醒目位置顯示原文連接配接,否則保留追究法律責任的權利。

繼續閱讀