Solved

Trim ldf

Posted on 2008-11-01
4
547 Views
Last Modified: 2013-11-05
I am doing FULL backups at 12:00 AM every night with the below script.  From 6:00 AM until 10:59:59 PM everyday I am running the lower most script every fifteen minutes.  Problems is that the database .ldf is growing and growing.  How do I trim it down prior/or during the Full backup?

BACKUP DATABASE [AdminDB] TO  DISK = N'\\clwfile03\system_backups$\CLWSQLPD01\AdminDB_FULL.Bak' WITH NOFORMAT, INIT,  NAME = N'AdminDB-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO

BACKUP LOG [AdminDB] TO DISK = N'\\clwfile03\system_backups$\CLWSQLPD01\AdminDB_Log.Trn' WITH RETAINDAYS = 1, NOFORMAT, NOINIT,
NAME = N'Pods-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
0
Comment
Question by:jsyers
  • 2
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 22858927
a single transaction log backup will rarely be enough, and in case you don't do it more often, you could as well change the database recovery mode from full to simple (and not do any transaction log backups at all).

so, run the t-log backups every hour (or even more), and the ldf file should stop growing.
0
 
LVL 59

Assisted Solution

by:Kevin Cross
Kevin Cross earned 250 total points
ID: 22858945
If you recovery model is set to FULL then the log truncation should happen automatically after your BACkUP LoG statement.  Here are some reasons that may delay this from Microsoft:

http://msdn.microsoft.com/en-us/library/ms345414.aspx

Maybe what you are seeing is delayed truncation unless I am missing something in one of the options you have set.
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 22858958
I agree with Angel.  Thought you indicated you were running the transaction log backup every 15 minutes...which is why I thought it should work as you have it.

Maybe try increasing the time to 1HR as that is what I am using as well and have had no problems with it not truncating.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now