Solved

Maintaining SQL Server logs size automatically to reserve disk space

Posted on 2016-10-02
4
64 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 12

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 12

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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

895 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

15 Experts available now in Live!

Get 1:1 Help Now