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’

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM