錯誤訊息
Can't allocate space for object syslogs in database dbname because
the logsegment is full. If you ran out of space in syslogs, dump
the transaction log. Otherwise use ALTER DATABASE or
sp_extendsegment to increase the size of the segment.
常見原因
- 大量交易:批次更新/插入/刪除產生大量記錄。
- 長時間未提交的交易:阻礙記錄截斷。
- 檢查點截斷頻寬不足:I/O 瓶頸導致截斷跟不上產生速度。
- 截斷閾值設定過高。
- 複合因素:上述多因素疊加。
- 複寫標記交易未被讀取:複寫環境下 Log Reader Agent 停止或延遲。
應對策略
- 定期執行
BACKUP LOG 截斷非作用中部分(完整復原模式下)。
- 簡單復原模式下,檢查點會自動截斷,但大量操作仍可能瞬間填滿,需擴大記錄檔或拆分批次。
- 監控 `DBCC SQLPERF(LOGSPACE)` 觀察使用率,設定警示。
- 複寫環境確保 Log Reader Agent 正常運行。
- 緊急時可 `ALTER DATABASE ... MODIFY FILE (SIZE = ...)` 擴大記錄檔,或暫時切換簡單復原模式強制截斷(會中斷複鏈)。