January 29, 2015 at 6:55 am
Hi, quick dba question if anyone can help.
Looking at the recovery model on MSDN - was under the belief from it that if you set your database to use the simple recovery model, then when you preform a full back up it would truncate the transaction log file but this doesn't seem to be the case?
Just wondering if there is a way of setting this. We aren't looking to do a point in time recovery for this particular databse.
Cheers
Rob
January 29, 2015 at 7:04 am
a transaction log is like a box : it's dimensions(size) do not change, only how full or empty it is.
So truncating the log empties the box to make room for more stuff, but doesn't make the box itself smaller.
if you want to shrink the log to recover some disk space, you have to explicitly run the shrink command.
if the log expanded to a given size, and is now empty, something made it expand(big transaction, reindexing), so it's very possible it would expand to the same larger size again automatically in the future.
Lowell
January 29, 2015 at 7:11 am
Full backups do not truncate the transaction log in any recovery model.
In full and bulk-logged recovery a log backup truncates the log.
In simple recovery a checkpoint truncates the log.
The myth that a full backup truncates the log came about because the first thing that a full backup does is run a checkpoint, and in simple recovery model that checkpoint truncates the log. It's not the full backup.
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
January 29, 2015 at 7:19 am
GilaMonster (1/29/2015)
In simple recovery a checkpoint truncates the log.
And even then there are drivers behind this, it won't necessarily truncate on every checkpoint
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
January 29, 2015 at 7:38 am
Perry Whittle (1/29/2015)
GilaMonster (1/29/2015)
In simple recovery a checkpoint truncates the log.And even then there are drivers behind this, it won't necessarily truncate on every checkpoint
It will truncate on checkpoint. It may not clear any of the log, but it will truncate.
Truncate: The marking of 0 or more VLFs as reusable.
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
January 30, 2015 at 2:16 am
GilaMonster (1/29/2015)
Full backups do not truncate the transaction log in any recovery model.In full and bulk-logged recovery a log backup truncates the log.
In simple recovery a checkpoint truncates the log.
The myth that a full backup truncates the log came about because the first thing that a full backup does is run a checkpoint, and in simple recovery model that checkpoint truncates the log. It's not the full backup.
Thanks, so from your response and others am I right in understanding that:
If you have a 20gb transaction log file in simple a recovery model
A full back up is run
A check point is made
The transaction log off the back of that is truncated
The log file still remains at 20gb on disk
If the first thing to run is a 100mb transaction it will start to fill the empty the log file as apposed to increasing it to 20.1gb?
Thanks for the advice 🙂
January 30, 2015 at 2:25 am
rob.lewis 86087 (1/30/2015)
If you have a 20gb transaction log file in simple a recovery model
A full back up is runA check point is made
The transaction log off the back of that is truncated
The log file still remains at 20gb on disk
If the first thing to run is a 100mb transaction it will start to fill the empty the log file as apposed to increasing it to 20.1gb?
Yup, though the backup has nothing to do with anything in this case. A checkpoint occurs (runs regularly), the log gets truncated.
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
January 30, 2015 at 6:53 am
GilaMonster (1/30/2015)
rob.lewis 86087 (1/30/2015)
If you have a 20gb transaction log file in simple a recovery model
A full back up is runA check point is made
The transaction log off the back of that is truncated
The log file still remains at 20gb on disk
If the first thing to run is a 100mb transaction it will start to fill the empty the log file as apposed to increasing it to 20.1gb?
Yup, though the backup has nothing to do with anything in this case. A checkpoint occurs (runs regularly), the log gets truncated.
Thank you 🙂
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply