<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Shrink - Techyaz.com</title>
	<atom:link href="https://techyaz.com/tag/shrink/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Tips, Tutorials and How-to Topics</description>
	<lastBuildDate>Fri, 01 Jun 2018 12:29:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>

<image>
	<url>https://techyaz.com/wp-content/uploads/2017/11/cropped-Site-icon-150x150.png</url>
	<title>Shrink - Techyaz.com</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Understanding Database Shrink Operation and Why Should We Avoid It?</title>
		<link>https://techyaz.com/sql-server/avoid-database-shrink-operation/</link>
					<comments>https://techyaz.com/sql-server/avoid-database-shrink-operation/#comments</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Fri, 16 Mar 2018 09:54:27 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[database property]]></category>
		<category><![CDATA[Shrink]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1951</guid>

					<description><![CDATA[<p>Database Shrink is a process to remove unused space allocated to the database or database files to the disk. When we shrink database log file or data files, it recovers space by moving pages of data from the end of&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/avoid-database-shrink-operation/">Understanding Database Shrink Operation and Why Should We Avoid It?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Database Shrink is a process to remove unused space allocated to the database or database files to the disk. When we shrink database log file or data files, it recovers space by moving pages of data from the end of the file to unoccupied space closer to the front of the file. Data that is moved to shrink database files can be scattered to any available location in the file. This causes index fragmentation and can slow the performance of queries that search a range of the index. To eliminate the fragmentation, consider rebuilding the indexes on the file after shrinking.</p>
<p><img fetchpriority="high" decoding="async" class="size-full wp-image-1952 alignright" src="http://techyaz.com/wp-content/uploads/2018/03/shrink.png" alt="Should We Shrink SQL Server Database or files?" width="300" height="300" srcset="https://techyaz.com/wp-content/uploads/2018/03/shrink.png 300w, https://techyaz.com/wp-content/uploads/2018/03/shrink-150x150.png 150w, https://techyaz.com/wp-content/uploads/2018/03/shrink-160x160.png 160w, https://techyaz.com/wp-content/uploads/2018/03/shrink-320x320.png 320w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>There are two ways to perform shrink operation on your SQL Server databases.</p>
<h5><span style="color: #333399;">Automatic Shrinking</span></h5>
<p>Automatic Shrinking can be enabled by setting <strong>Auto_Shrink</strong> database property to ON. SQL Server database engine will automatically perform shrink database operation on your database whenever required. Unless we have a specific requirement, we should not set the AUTO_SHRINK database option to ON because it degrades your database performance. SQL Server shrink database files also increases IO overhead that leads to poor performance. Read below article where I have explained how this option degrades database performance and why we should not set Auto_Shrink database option to ON.</p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/always-turn-off-database-auto-shrink/" target="_blank" rel="noopener">Why Should You Always Turn Off Database Auto Shrink Property?</a></strong></li>
</ul>
<h5><span style="color: #333399;">Manual Shrinking</span></h5>
<p>We can use DBCC SHRINKDATABASE or DBCC SHRINKFILE statement to manually shrink database log file or data file within a database. Shrink database operation runs at file level. When you use DBCC SHRINKDATABASE, it also shrink the size of data or log files. We can stop the execution of DBCC SHRINKDATABASE and DBCC SHRINKFILE operations at any point in the process, and any completed work is retained.</p>
<p>One question most of the DBA ask that should we shrink database or should we shrink database log file or data file in SQL Server?The answer of this question is simple, we should not perform shrink operation regularly. Database Shrink operation is resource intensive operations because data pages are moved from the end of the file to unoccupied space closer to the front of the file. This process put pressure on system IO and CPU and also causes high fragmentation. You might also face some blocking issues during the shrink operation. That&#8217;s the reason it’s not recommended to shrink data file or log file on frequent or routine basis. SQL Server shrink database files should be avoided.</p>
<p>We should generally perform shrink operation if we truncate or drop table or tables from the database. If we remove or purge bigger chunk of data from your database then also we can perform shrink operation to reclaim the unused space to the disk. Always leave some space to the database to perform its routine operations. Most databases require some free space for regular day-to-day operations. Do Not Shrink such databases and their database files because databases will again allocate required space for their operation. Make sure to rebuild your indexes post database shrink operation if you need to perform it.</p>
<p>Also you should keep this in mind that we cannot shrink a database while the database is being backed up. Similarly, you cannot backup a database while a shrink operation on the database is in process. Here you have learnt about SQL Server shrink database files.<br />
I hope you like this article. Please follow our <a href="https://www.facebook.com/Techyaz/">Facebook</a> page and <a href="https://twitter.com/Tech_yaz">Twitter</a> handle to get latest updates.</p>
<p><span style="color: #800000;"><em><strong>Read More:</strong></em></span></p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/always-turn-off-database-auto-shrink/" target="_blank" rel="noopener">Why Should You Always Turn Off Database Auto Shrink Property?</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">What is the best value for database file autogrowth?</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/troubleshooting/fix-msg-5144-and-5145-for-long-or-failed-autogrow/" target="_blank" rel="noopener">Fix SQL Server Error 5144 and 5145: Failed Data or Log file Autogrow Operation</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/troubleshooting/fix-error-3023-error-3013-error-3041/" target="_blank" rel="noopener">Fix Error 3023: Shrink failed for Log file</a></strong></li>
</ul>
<p>The post <a href="https://techyaz.com/sql-server/avoid-database-shrink-operation/">Understanding Database Shrink Operation and Why Should We Avoid It?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/avoid-database-shrink-operation/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Fix SQL Server Error 3023: Shrink failed for LogFile &#8220;Log File Name&#8221;</title>
		<link>https://techyaz.com/sql-server/fix-error-3023-error-3013-error-3041/</link>
					<comments>https://techyaz.com/sql-server/fix-error-3023-error-3013-error-3041/#comments</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Mon, 20 Nov 2017 12:48:01 +0000</pubDate>
				<category><![CDATA[Backup & Recovery]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Autoshrink]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[HowTO]]></category>
		<category><![CDATA[Shrink]]></category>
		<category><![CDATA[SQL_Error_Code]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1175</guid>

					<description><![CDATA[<p>Today, I got below Microsoft SQL Server error 3023 when I was trying to manually shrink a log file. The error details are given below: Shrink failed for LogFile &#8216;Logfile_Name&#8221;. Backup, file manipulation operations (such as ALTER DATABASE ADD FILE)&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/fix-error-3023-error-3013-error-3041/">Fix SQL Server Error 3023: Shrink failed for LogFile &#8220;Log File Name&#8221;</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Today, I got below Microsoft SQL Server error 3023 when I was trying to manually shrink a log file. The error details are given below:</p>
<p><span style="color: #ff0000;"><em>Shrink failed for LogFile &#8216;Logfile_Name&#8221;.</em><br />
<em>Backup, file manipulation operations (such as ALTER DATABASE ADD FILE) and encryption changes on a database must be serialized. Reissue the statement after the current backup or file manipulation operation is completed. (Microsoft SQL Server, Error: 3023)</em><br />
</span><br />
Here is the screenshot of this error:</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1176" src="http://techyaz.com/wp-content/uploads/2017/11/Error-3023.jpg" alt="error 3023" width="608" height="203" srcset="https://techyaz.com/wp-content/uploads/2017/11/Error-3023.jpg 608w, https://techyaz.com/wp-content/uploads/2017/11/Error-3023-300x100.jpg 300w" sizes="(max-width: 608px) 100vw, 608px" /></p>
<p>We get this error when there is a conflict between <a href="https://techyaz.com/sql-server/understanding-sql-server-backups/" target="_blank" rel="noopener">backup operation</a> and <a href="https://techyaz.com/sql-server/always-turn-off-database-auto-shrink/" target="_blank" rel="noopener">Shrink operation</a>. SQL Server are designed to follow some rules during Backup and Shrink operations. These are given below:</p>
<ol>
<li>We can run only one database backup at a time. When a full database backup occurs, differential or incremental backups cannot occur at the same time.</li>
<li>Only one log backup can happen at a time. A log backup is allowed when a full database backup is occurring.</li>
<li>You cannot add or drop files to a database while a backup is occurring.</li>
<li>You cannot shrink files while database backups are happening.</li>
<li>There are limited recovery model changes allowed while backups are occurring.</li>
</ol>
<p>When any of these conflicting operations are performed, the commands will be receiving the SQL Server error 3023, SQL Server error 3013 and SQL Server error 3041 messages.</p>
<p>You might also get below error when you perform another database backup if backup is already running for your database.</p>
<p><em><span style="color: #ff0000;">Msg 3013, Level 16, State 1, Line 1<br />
BACKUP DATABASE is terminating abnormally.</span></em></p>
<p>Or if you try to run a differential backup for a database for which full backup is already running, you will get below error code:</p>
<p><em><span style="color: #ff0000;">Backup Error: 3041, Severity: 16, State: 1.<br />
BACKUP failed to complete the command BACKUP DATABASE MyDatabase WITH DIFFERENTIAL. Check the backup application log for detailed messages.</span></em></p>
<p>Solution to fix such issues is to examine the schedules of the various database maintenance activities, and then adjust the schedules so that these operations or commands do not conflict with each other.</p>
<p>Make sure to not run any operation that will conflict with each other. If you get such errors check your SQL Server Agent jobs and wait till that job will be completed. In my case, database backup was running while I was trying to shrink a log file. I did wait for some time and then tried again to shrink that file and this time SQL Server allowed me to run this shrink operation.</p>
<p>Here, i have explained how to fix Microsoft SQL Server error 3023,  error 3013 and error 3041. I hope you like this article. Please follow our <a href="https://www.facebook.com/Techyaz/">Facebook</a> page and <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p>The post <a href="https://techyaz.com/sql-server/fix-error-3023-error-3013-error-3041/">Fix SQL Server Error 3023: Shrink failed for LogFile &#8220;Log File Name&#8221;</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/fix-error-3023-error-3013-error-3041/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
