Solved

Maintaining SQL Server logs size automatically to reserve disk space

Posted on 2016-10-02
4
66 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 13

Expert Comment

by:Nakul Vachhrajani
ID: 41825402
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
ID: 41825619
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 13

Accepted Solution

by:
Nakul Vachhrajani earned 500 total points
ID: 41825627
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
ID: 41825628
Thanks Nakul
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard 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.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

749 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