Solved

Maintaining SQL Server logs size automatically to reserve disk space

Posted on 2016-10-02
4
61 Views
Last Modified: 2016-10-02
Hi All,

I've got SQL Server 2012 Std database that is always running out of disk space.
The culprit is that the Web proxy reporting software which is growing larger that 275 GB while the disk space in the Physical server D: drive ia only 279 GB maximum.

So I wonder how can I automate the SQL Server to truncate the SQL Database .LDF file to be always lower than 100 GB to maintain disk space size which is not impacting the Web reporting software.

Thanks,
0
Comment
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:Nakul Vachhrajani
Comment Utility
You can restrict the max size of the log file, but, first things first - what is the recovery model of the database? If it is FULL recovery, are you taking regular log backups?

If you are not taking log backups and the recovery model is FULL, that would explain an ever growing log file. Otherwise, the log file should get "recycled" as soon as you take the log backup.
0
 
LVL 7

Author Comment

by:Senior IT System Engineer
Comment Utility
Ok Nakul,
The backup mode was full, so how do I automate make the truncate only the log file or not needed after I changed it to simple ?
0
 
LVL 11

Accepted Solution

by:
Nakul Vachhrajani earned 500 total points
Comment Utility
Simple recovery makes sense if you do not need point in time recovery of the reporting database. If you need point-in-time recovery, you will need to use FULL recovery and take regular log backups.

If the database is in simple recovery mode, you generally do not need to implement any automatic truncation. The checkpoint process will automatically take care of marking space within the log as "available" once data has been flushed to the data files.

So, I would suggest to keep monitoring your log file - long and bulky transactions (typically indicative of code that can still be tuned) can still result into huge log files. But for most cases, you should be all set if the recovery model is simple.
0
 
LVL 7

Author Closing Comment

by:Senior IT System Engineer
Comment Utility
Thanks Nakul
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

771 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

11 Experts available now in Live!

Get 1:1 Help Now