SCRIPT: Why database log files are not truncating?

 SELECT name, log_reuse_wait_desc FROM sys.databases;

Possible values:

  • 0 = Nothing (should truncate if it is 0)
  • 1 = Checkpoint (When a database has a memory-optimized data filegroup, you should expect to see the log_reuse_wait column indicate checkpoint or xtp_checkpoint) 
  • 2 = Log Backup 
  • 3 = Active backup or restore 
  • 4 = Active transaction 
  • 5 = Database mirroring 
  • 6 = Replication 
  • 7 = Database snapshot creation 
  • 8 = Log scan
  • 9 = An Always On Availability Groups secondary replica applies transaction log records of this database to a corresponding secondary database. 
  • 9 = Other (Transient) 
  • 10 = For internal use only 
  • 11 = For internal use only 
  • 12 = For internal use only 
  • 13 = Oldest page 
  • 14 = Other 
  • 16 = XTP_CHECKPOINT

Comments