SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Ginormous Production Log File - Help!


Ginormous Production Log File - Help!

Author
Message
Seggerman-675349
Seggerman-675349
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2739 Visits: 608
the log file for a database for a fairly small database is up to 46 Gig - and growing
it is threatening to fill the virtual server, bringing the web application to a complete halt
I tried to shrink - no dice
how do I safely shrink it?
shouldn't it truncate when a full backup is taken?

thanks
a newbie DBA, not by choice
ZZartin
ZZartin
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24355 Visits: 16491
No you need to run a log backup then you will be able to shrink it, and if the database is in full or bulk recovery mode you need to be running regular log backups.
Sue_H
Sue_H
SSC Guru
SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)

Group: General Forum Members
Points: 67144 Visits: 13950
Seggerman-675349 - Monday, March 12, 2018 3:00 PM
the log file for a database for a fairly small database is up to 46 Gig - and growing
it is threatening to fill the virtual server, bringing the web application to a complete halt
I tried to shrink - no dice
how do I safely shrink it?
shouldn't it truncate when a full backup is taken?

thanks
a newbie DBA, not by choice


Usually when your log blows up like that, check the log reuse value in sys.databases - you just execute:
select name, log_reuse_wait_desc, recovery_model_desc 
from sys.databases

If it's in full recovery model and the the log_reuse_wait_desc is log_backup, backup the log.

Sue



Seggerman-675349
Seggerman-675349
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2739 Visits: 608
thanks
how does backing up a log file free up space? doesn't it simply use up more?
please, I'm new at this
concrete steps
sample SQl
do DIFF backups still work with SIMPLE recovery?
Andreas Kreuzberg
Andreas Kreuzberg
SSCarpal Tunnel
SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)

Group: General Forum Members
Points: 4359 Visits: 1714
Hi,
a backup won't shrink you logfiles. The internal LSN are marked for reuse.

Try to look the usage of your logfile

DBCC sqlperf (logspace)


If there is free enough space, feel free to shrink your logfile.


GilaMonster
GilaMonster
SSC Guru
SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)

Group: General Forum Members
Points: 888124 Visits: 48655
If the database is in full recovery (almost certainly) then the log gets retained until a log backup is taken. Not a full backup, not a differential, a log. This is because full recovery model is an indication to SQL that you need point in time recovery on that database (the ability to restore to any point in time in the case of a disaster)

If that is the case, then you need to schedule log backups. They will, after writing the log to a backup file, the backup process will mark the log records within the file as reusable, meaning they can now be overwritten (or removed with a shrink operation)

If you don't need point in time recovery, if you're OK losing everything back to a full backup if the case of a disaster, then change the database to simple recovery model, and once you've done that you'll be able to shrink the down to a sensible size, no log backups necessary (or possible)

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Sue_H
Sue_H
SSC Guru
SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)

Group: General Forum Members
Points: 67144 Visits: 13950
Seggerman-675349 - Tuesday, March 13, 2018 7:24 AM
thanks
how does backing up a log file free up space? doesn't it simply use up more?
please, I'm new at this
concrete steps
sample SQl
do DIFF backups still work with SIMPLE recovery?


What is did that query show you? What is the recovery model and what was the log reuse wait description? Some of what you do depends on what those tell you. Check those first and let us know what it says.

For the other questions, backing up the log allows space in the file to be reused. That's what they call truncating the log. It's not the same as shrinking the log - so you don't want to confuse the two.
You can take differential backups when you're in simple recovery but they aren't likely to affect the log at all.

Sue



Seggerman-675349
Seggerman-675349
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2739 Visits: 608
Sue_H - Tuesday, March 13, 2018 7:56 AM
Seggerman-675349 - Tuesday, March 13, 2018 7:24 AM
thanks
how does backing up a log file free up space? doesn't it simply use up more?
please, I'm new at this
concrete steps
sample SQl
do DIFF backups still work with SIMPLE recovery?


What is did that query show you? What is the recovery model and what was the log reuse wait description? Some of what you do depends on what those tell you. Check those first and let us know what it says.

For the other questions, backing up the log allows space in the file to be reused. That's what they call truncating the log. It's not the same as shrinking the log - so you don't want to confuse the two.
You can take differential backups when you're in simple recovery but they aren't likely to affect the log at all.

Sue


thank you people (I'd say guys but it looks like I am getting advice from wise women here)
we are going with adding more disk space, backing up the log file, shrinking it, then changing it to SIMPLE
I haven't been on the server yet - I don't normally work Tuesday
GilaMonster
GilaMonster
SSC Guru
SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)SSC Guru (888K reputation)

Group: General Forum Members
Points: 888124 Visits: 48655
If you're going to switch to simple recovery, don't bother taking log backups first. Just switch to simple, and then shrink the log to a sensible size.

Just keep in mind that simple recovery means that if something happens to the DB (accidental delete, hardware failure), you may lose data back to the last full backup. Make sure that's acceptable before deciding on the recovery model.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Seggerman-675349
Seggerman-675349
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2739 Visits: 608
update - my client worked with a DBA (the real deal) at Liquid Web, the hosting company
- bought 50 G's on a cloud - and backed up the database log to that
shrunk it, then set it to SIMPLE
I need to let my client know that if we ever need to restore we will have to back one day (I set up a DIFF to run every morning)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search