Understanding Transaction Log Truncation in SQL Server 2022

Roberto Limongello 0 Reputation points
2025-01-21T08:37:26.9166667+00:00

In an Azure SQL Server 2022 environment with multiple databases configured with FULL recovery mode, hourly log backups are taken, and full backups occur nightly.

According to the documentation, the expectation is that the log space usage should decrease to 0 or close to it after each log backup. However, observations show that the log space continues to grow over several days. While there are instances where the log is truncated, the specific circumstances leading to this behavior are unclear.

Standard troubleshooting steps have been taken, including monitoring the log_wait_reuse flag (which remains at NOTHING) and checking the recovery model interval (currently at 0), among other diagnostics.

What could be missing in this scenario?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,377 questions
{count} votes

2 answers

Sort by: Most helpful
  1. RahulRandive 10,146 Reputation points
    2025-01-22T21:37:47.89+00:00

    Hi @Roberto Limongello

    If the log space usage continues to grow despite regular log backups, it could be due to several factors:

    1. In-Memory OLTP Checkpoints: If the databases have the In-Memory OLTP feature enabled, the transaction log might be waiting for an In-Memory OLTP checkpoint to occur.
    2. Active Transactions: Long-running or uncommitted transactions can prevent log truncation.
    3. Replication or CDC: If CDC or replication is enabled, it might be causing the log to grow.
    4. Database Mirroring or Availability Groups: If the database is part of a mirroring setup or an availability group, synchronization issues might prevent log truncation.

    Thank You!


  2. Roberto Limongello 0 Reputation points
    2025-01-27T08:59:50.5766667+00:00

    @Erland Sommarskog I checked the dm_db_log_space_usage but they are the same % of occupation.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.