<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: A Primer on Log Shrinking and Truncation in SQL Server</title>
	<atom:link href="http://www.sql-server-performance.com/2012/log-shrinking-truncate-sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sql-server-performance.com/2012/log-shrinking-truncate-sql-server/</link>
	<description>SQL Server Performance Tuning</description>
	<lastBuildDate>Fri, 17 May 2013 13:31:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Tim Poll</title>
		<link>http://www.sql-server-performance.com/2012/log-shrinking-truncate-sql-server/#comment-1980</link>
		<dc:creator>Tim Poll</dc:creator>
		<pubDate>Fri, 08 Jun 2012 02:35:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?p=2943#comment-1980</guid>
		<description><![CDATA[I use the UI to perform a shrink on the transaction file, then backup the transaction file, then perform the shrink again.  There is no need to change your recovery model and thus break the LSN chain.  I don&#039;t remember the specifics, but the shrink operation needs to be run twice because the first time it was run, if the new entries are being written to the log at the end of the file, not all unused space can be physically removed.  However, if the shrink operation detects this, it will fill up the rest of the log file with null space (or reset the pointer).  Then when a transaction backup happens, the virtual space at the end of the log file is removed.  Durning the second shrink, the log file will physically shrink to its smallest size.  Then you can let it grow as needed, but hopefully max out at a smaller size.]]></description>
		<content:encoded><![CDATA[<p>I use the UI to perform a shrink on the transaction file, then backup the transaction file, then perform the shrink again.  There is no need to change your recovery model and thus break the LSN chain.  I don&#8217;t remember the specifics, but the shrink operation needs to be run twice because the first time it was run, if the new entries are being written to the log at the end of the file, not all unused space can be physically removed.  However, if the shrink operation detects this, it will fill up the rest of the log file with null space (or reset the pointer).  Then when a transaction backup happens, the virtual space at the end of the log file is removed.  Durning the second shrink, the log file will physically shrink to its smallest size.  Then you can let it grow as needed, but hopefully max out at a smaller size.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth</title>
		<link>http://www.sql-server-performance.com/2012/log-shrinking-truncate-sql-server/#comment-1938</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Thu, 17 May 2012 21:21:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?p=2943#comment-1938</guid>
		<description><![CDATA[Thanks for the comment, Christian. The DBCC SHRINKFILE TRUNCATEONLY option targets the data file only, not the log file.  It does not apply if you are using DBCC SHRINKFILE on a transaction log file.  The MSDN Library says:
TRUNCATEONLY
Releases all free space at the end of the file to the operating system but does not perform any page movement inside the file. The data file is shrunk only to the last allocated extent.
TRUNCATEONLY is applicable only to data files.
http://msdn.microsoft.com/en-us/library/ms189493.aspx]]></description>
		<content:encoded><![CDATA[<p>Thanks for the comment, Christian. The DBCC SHRINKFILE TRUNCATEONLY option targets the data file only, not the log file.  It does not apply if you are using DBCC SHRINKFILE on a transaction log file.  The MSDN Library says: </p>
<p>TRUNCATEONLY<br />
Releases all free space at the end of the file to the operating system but does not perform any page movement inside the file. The data file is shrunk only to the last allocated extent.<br />
TRUNCATEONLY is applicable only to data files.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms189493.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms189493.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Tarnutzer</title>
		<link>http://www.sql-server-performance.com/2012/log-shrinking-truncate-sql-server/#comment-1855</link>
		<dc:creator>Christian Tarnutzer</dc:creator>
		<pubDate>Tue, 24 Apr 2012 10:16:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?p=2943#comment-1855</guid>
		<description><![CDATA[Nice and small Primer, Seth!
Still, there could be an addition: Why not use TRUNCATEONLY in the DBCC command? It truncates just back to the point of the last log backup (or the given size, if that&#039;s reached before) and does not need a switch to SIMPLE recovery, thus not breaking the LSN chain:
USE AdventureWorks
GO
DBCC SHRINKFILE (AdventureWorks_Log, 10, TRUNCATEONLY)
Important is to run this command after a log backup and best after a checkpoint. Like this you are sure that the log contains as less virtual log files as possible. But be aware that if you truncate the log too much, it will have to grow right after this operation. And logfile growth in FULL recovery needs time and therefore slows down transactions on the database]]></description>
		<content:encoded><![CDATA[<p>Nice and small Primer, Seth!<br />
Still, there could be an addition: Why not use TRUNCATEONLY in the DBCC command? It truncates just back to the point of the last log backup (or the given size, if that&#8217;s reached before) and does not need a switch to SIMPLE recovery, thus not breaking the LSN chain:</p>
<p>USE AdventureWorks<br />
GO<br />
DBCC SHRINKFILE (AdventureWorks_Log, 10, TRUNCATEONLY)</p>
<p>Important is to run this command after a log backup and best after a checkpoint. Like this you are sure that the log contains as less virtual log files as possible. But be aware that if you truncate the log too much, it will have to grow right after this operation. And logfile growth in FULL recovery needs time and therefore slows down transactions on the database</p>
]]></content:encoded>
	</item>
</channel>
</rss>
