SQL Server 2008 - Shrinking the Transaction Log - Any way to automate?

后端 未结 6 505
醉酒成梦
醉酒成梦 2021-02-03 14:30

I went in and checked my Transaction log the other day and it was something crazy like 15GB. I ran the following code:

USE mydb
GO
BACKUP LOG mydb WITH TRUNCATE         


        
6条回答
  •  -上瘾入骨i
    2021-02-03 15:02

    Creating a transaction log backup doesn't mean that the online transaction log file size will be reduced. The file size remains the same. When a transaction is backuped up, in the online transaction log it's marked for overwriting. It;s not automatically removed, and no spaces is freed, therefore, the size remains the same.

    Once you set the LDF file size, maintain its size by setting the right transaction log backup frequency.

    Paul Randal provides details here:

    Understanding Logging and Recovery in SQL Server

    Understanding SQL Server Backups

提交回复
热议问题