Avatar of websss
websss
Flag for Kenya asked on

managing sql log files - recommendations please

Hi

I have a asset tracking app which tracker people and cars, we use sql server 2014 enterprise
Currently the MDF is at 3gb and the LDF is at 33GB

the recovery model is set to full, and i've just left it that way, but now the log file is becoming too big, I need to manage that properly

One suggestion from the team was to set the log file to 10GB, and have a sliding thing so it only keeps the latest data (we only really care about the last 1 month/ 1 week but it we keep up to 1 year)

Does this sliding thing actually exist?

based on the brief above, how would you manage this large log file?
Microsoft SQL ServerMicrosoft SQL Server 2008

Avatar of undefined
Last Comment
Scott Pletcher

8/22/2022 - Mon
Vitor Montalvão

Do you have any transaction log backup scheduled? If affirmative, how often it runs?
websss

ASKER
Hi Vitor
No I have nothing like this
ASKER CERTIFIED SOLUTION
Vitor Montalvão

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jose Torres

Ditto to Vitor's comments.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Scott Pletcher

You first need to decide, at a business level, how long a period of time you can afford to lose data for.  But be realistic, as the shorter the time frame, the more work it is on the database side. That decision will determine whether or not you need to backup log files, or if you can go to simple mode and skip the log backups completely.

For example, if you decide you just need a database backup no more often than, say, every six hours, meaning you could lose all activity between each backup, put the db in simple mode and do a full backup that often (for a db of only 3gb, I don't see a need to mess with differential backups at that time range).

If you decide on less than six hours, say, then you could use either differential backups, as above, or use full recovery model, including regularly scheduled log backups, or a mix of the two.  In that case, you would also need to do some "practice" recoveries using log files, since applying log files to a backup takes some getting used to.
websss

ASKER
Thanks all
We need FULL

and I need to keep the last 1 month and ideally I would like to keep as much new data as possible,  but I guess if I had to choose a number I could loose the last 30 mins

Does that mean I need to do a full backup (.Bak) every month,  and then do differental every 30 mins?
Scott Pletcher

Full backup every week.  Differential backup every 12 hours (or however many hours you prefer).  Tran log backup every 30 minutes.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
websss

ASKER
Great thanks
Do I delete the bak file every week and only keep latest?

Do I do the same with differential etc
SOLUTION
Scott Pletcher

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.