<?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>database property - Techyaz.com</title>
	<atom:link href="https://techyaz.com/tag/database-property/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Tips, Tutorials and How-to Topics</description>
	<lastBuildDate>Fri, 23 Jul 2021 12:59:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8</generator>

<image>
	<url>https://techyaz.com/wp-content/uploads/2017/11/cropped-Site-icon-150x150.png</url>
	<title>database property - Techyaz.com</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Change Database Default Locations in SQL Server?</title>
		<link>https://techyaz.com/sql-server/change-database-default-locations-sql-server/</link>
					<comments>https://techyaz.com/sql-server/change-database-default-locations-sql-server/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Thu, 03 May 2018 11:16:42 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[data file]]></category>
		<category><![CDATA[data_files]]></category>
		<category><![CDATA[database property]]></category>
		<category><![CDATA[log files]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=2215</guid>

					<description><![CDATA[<p>Sometimes, we need to change default database File locations to some other path in SQL Server. If you have configured SQL Server default database file location as drive C then all SQL Server databases will be created in the path&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/change-database-default-locations-sql-server/">How to Change Database Default Locations in SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Sometimes, we need to change default database File locations to some other path in SQL Server. If you have configured SQL Server default database file location as drive C then all SQL Server databases will be created in the path set as database default locations if you have not mentioned their specific drives during database creation. You might need to change this path as per your environment standard. Here, I am going to show you how to view or change database default location in SQL Server.</p>
<p>One thing we should always keep in mind that if we change database default path in SQL Server then it will not change or move the database file locations for your existing databases. If you want to move all existing databases or you want to change database files path to the new location then you need to manually do it for each database.</p>
<p>Once you will change default database file locations then all databases you will create on that SQL Server Instance will be created on new location. Suppose your existing SQL Server default database location is set in C drive and now you have decided to change it to D drive for data files and F drive for Log files then all databases you will create post this change will be created in these both drives. If you will mention any other specific drive during database creation then SQL Server uses that drive and not these database default locations. The SQL Server data file will be created in D drive and log file will be created in F drive but all the existing databases that were created earlier in C drive will not move to new SQL server database file location. If you want to move these databases or want to change database files location then you need to manually do it either by detach-attach method or by ALTER statement.</p>
<h3><span style="color: #333399;">Change Database Default Locations in SQL Server</span></h3>
<p>It&#8217;s very simple method to change default log file location or default data file location in SQL Server. Let’s start to change default database path in SQL Server.</p>
<ul>
<li>Launch SQL Server Management Studio and connect to your SQL Server Instance for which you must change default log file location or default data file location in SQL Server.</li>
<li>Now right click at SQL Server Instance node and choose Properties option.</li>
<li>You will get server properties window on your screen. Click at “Database Settings” from left side pane. You will get all server level details for SQL Server databases in right side pane. Look at the database default locations option given bottom of the right-side pane. Here you can see separate default location for data files, Log file and backup files.</li>
</ul>
<p><img fetchpriority="high" decoding="async" class="size-full wp-image-2216 aligncenter" src="http://techyaz.com/wp-content/uploads/2018/05/default-db-path-min.png" alt="Change Default database file location in SQL Server" width="693" height="631" srcset="https://techyaz.com/wp-content/uploads/2018/05/default-db-path-min.png 693w, https://techyaz.com/wp-content/uploads/2018/05/default-db-path-min-300x273.png 300w" sizes="(max-width: 693px) 100vw, 693px" /></p>
<ul>
<li>You can see database default locations for each file are showing in C drive. It means every database that will be created without mentioning their data or log file location will go to above given SQL Server database default locations.</li>
<li>To change database default path, you need to browse current database default locations for each file to new the new location. Click at three dots showing next to data file or log file locations and then select the new path.</li>
<li>Repeat same exercise for each file. To change default data file location, click at three dots next to data path and select new path here. Similarly, click at three dots next to log file location to change default log file location. If you want to change default backup file location then do the same for backup location as well.</li>
<li>Click ak Ok button once you made changes for desired database file locations.</li>
<li>Last step is to restart SQL Server services to apply this change and bring it into effect.</li>
</ul>
<p>Once you will restart SQL Server services, your SQL Server default database location will be changed to the new path. 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/get-total-virtual-log-files/" target="_blank" rel="noopener">Get Total Number of Virtual Log Files in SQL Server Transaction Log File</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/troubleshooting/fix-error-1105/" target="_blank" rel="noopener">SQL Server Error 1105: Could Not Allocate Space for Object in Database because the filegroup is full</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/troubleshooting/change-sql-server-instance-name/" target="_blank" rel="noopener">How to Change SQL Server Instance Name?</a></strong></li>
<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>
<p>&nbsp;</p>
<p>The post <a href="https://techyaz.com/sql-server/change-database-default-locations-sql-server/">How to Change Database Default Locations in SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/change-database-default-locations-sql-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Fix Error 1101: Could not allocate a new page for database</title>
		<link>https://techyaz.com/sql-server/troubleshooting/fix-error-1101-could-not-allocate-a-new-page-for-database/</link>
					<comments>https://techyaz.com/sql-server/troubleshooting/fix-error-1101-could-not-allocate-a-new-page-for-database/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Fri, 23 Mar 2018 13:20:48 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[autogrow]]></category>
		<category><![CDATA[autogrowth setting]]></category>
		<category><![CDATA[data file autogrow]]></category>
		<category><![CDATA[data_files]]></category>
		<category><![CDATA[database property]]></category>
		<category><![CDATA[log space]]></category>
		<category><![CDATA[log_files]]></category>
		<category><![CDATA[space issues]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1987</guid>

					<description><![CDATA[<p>We get error 1101 because of space issues. Database engine doesn’t able to allocate new pages to the database because of insufficient disk space. The error details are given below: Error: 1101, Severity: 17, State: 2 Could not allocate a&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/troubleshooting/fix-error-1101-could-not-allocate-a-new-page-for-database/">Fix Error 1101: Could not allocate a new page for database</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We get error 1101 because of space issues. Database engine doesn’t able to allocate new pages to the database because of insufficient disk space. The error details are given below:</p>
<p><em><span style="color: #ff0000;">Error: 1101, Severity: 17, State: 2</span></em><br />
<em><span style="color: #ff0000;"> Could not allocate a new page for database ‘DBNAME&#8217; because of insufficient disk space in filegroup &#8216;PRIMARY&#8217;. Create the necessary space by dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.</span></em></p>
<p>There is another error 1105 that is also very much like above error code. Error 1105 can also be fixed using same solution given in this article.</p>
<h3><span style="color: #333399;">Error 1101 &#8211; Root Cause</span></h3>
<p>Main reason behind error 1101 or error 1105 is the insufficient disk space in filegroup/files. You might also get this error if your database drives are running out of space. There are multiple reasons that can cause this error to generate. Some of them are given below.</p>
<ul>
<li>You have restricted database maximum file size or put size limits for files.</li>
<li>Database file drives are running out of space.</li>
<li>Autogrowth is not enabled for database files.</li>
</ul>
<h3><span style="color: #333399;">Solutions</span></h3>
<p>To fix this issue we need to make space for database files to grow. Issue might vary depending on the nature of issue mentioned in above section. Sometimes, you might face this issue if maximum size for database files are restricted to some values so whenever database will grow to that point, SQL Server will not allow to allocate any page to that database. Sometimes you might get error 1101 because you don’t have any space on your database drives. Here, I will discuss each case individually and its solution to fix it.</p>
<h5><span style="color: #993300;">Unrestrict or Increase Database File Size Limits</span></h5>
<p>You might have enough space in your database drives but still you can get error 1101 because the maximum file size of database files is limited to some value and that causes not to grow your database beyond that size. You can unrestrict or increase the existing value of maximum file size to some bigger value. We have also an option to set database file size to unlimited size value that means database file will grow till the database file drive limit. Make sure to set appropriate autogrowth size for each database files.</p>
<p>You can set unlimited file size option or increase the value of maximum file size using GUI in SQL Server Management Studio or using ALTER statement.</p>
<ul>
<li>Connect to Database Instance in <strong>SQL Server Management Studio</strong>. Expand <strong>Database</strong> folder.</li>
<li>Right Click on your database and choose <strong>Property window</strong>.</li>
<li>Click on <strong>Files</strong> tab from left side pane in database property window.</li>
<li>Here you can see all database files. Now you can click on three dots given next of database files in “Autogrowth/Maxsize” column. You can see max size is set to a limited value as shown in below screenshot. I have chosen unlimited option and clicked on Ok button.</li>
</ul>
<p><img decoding="async" class="aligncenter wp-image-1991 size-full" src="http://techyaz.com/wp-content/uploads/2018/03/1-SizeLimit-min.jpg" alt="Set Database file size to unlimited" width="394" height="314" srcset="https://techyaz.com/wp-content/uploads/2018/03/1-SizeLimit-min.jpg 394w, https://techyaz.com/wp-content/uploads/2018/03/1-SizeLimit-min-300x239.jpg 300w" sizes="(max-width: 394px) 100vw, 394px" /></p>
<p>Now we will not get any issue if our database drive has enough space.</p>
<h5><span style="color: #993300;">Space in Database Drives</span></h5>
<p>Another possibility for this error is, there might be possibility that your drives on which you have placed your database files are running out of space. If this is the case then you have below 4 options.</p>
<ul>
<li>Add additional database file to different disk where there is enough space.</li>
<li>Move additional/unwanted files from your existing database drives.</li>
<li>Drop/Purge or Move unwanted data (table/indexes)</li>
<li>Add Additional Disk Space</li>
</ul>
<p>Immediate fix of this issue is to add new database file to another drive where you have enough space to run your transactions. You can use below command to add addition database file to another disk.</p>
<pre><strong><span style="color: #0000ff;">USE [master]</span></strong>
<strong><span style="color: #0000ff;">GO</span></strong>
<strong><span style="color: #0000ff;">ALTER DATABASE [DBNAME]</span></strong>
<strong><span style="color: #0000ff;">ADD FILE (NAME = N'NewFileName', FILENAME = N'F:\mssql\data\newdatafile.ndf', SIZE = 100096KB, FILEGROWTH = 10240KB)</span></strong>
<strong><span style="color: #0000ff;">TO FILEGROUP [SECONDARY]</span></strong>
<strong><span style="color: #0000ff;">GO</span></strong></pre>
<p>You can also add new database file in SQL Server Management Studio by launching Database Property Window. Select Files from left side pane and Click on “Add” button showing in below screenshot. Make sure to set autogrowth value carefully for any database file. Also it is recommended to enable IFI – Instant File Initialization to speed up autogrowth process for your databases. Refer to below article to get best value for autogrowth for your database files. You can also read what are the benefits and how to enable IFI &#8211; Instant File Initialization in below article.</p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">What Should be the Best Value for database Autogrowth settings?</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">How to Enable Instant File Initialization in SQL Server?</a></strong></li>
</ul>
<p><img decoding="async" class="aligncenter wp-image-1993 size-full" src="http://techyaz.com/wp-content/uploads/2018/03/2-SizeLimit.jpg" alt="Add database file using GUI" width="705" height="633" srcset="https://techyaz.com/wp-content/uploads/2018/03/2-SizeLimit.jpg 705w, https://techyaz.com/wp-content/uploads/2018/03/2-SizeLimit-300x269.jpg 300w" sizes="(max-width: 705px) 100vw, 705px" /></p>
<p>You can also have a look at the existing database drives whether there is any unwanted files or older backup files (*.bak) are not stored. Sometimes we run backups into database drives and forgot to delete or move them. Make sure to drop or move all unwanted files to some other location. Database drives should have only database files.</p>
<p>Final and long-term solution is the data purging. Identify the database objects that are not needed and then plan the data removal or data purging process to make space on your database.</p>
<p>We also have an option to extend the database drives as per the data growth. Make sure to plan this activity carefully before deploying it on production servers.</p>
<h5><span style="color: #993300;">Enable Autogrowth</span></h5>
<p>I have already written an article on Database autogrowth property setting. Read attached article to <a href="http://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">find out best value for Autogrowth settings</a>.</p>
<p>You might get error 1101 if you have not enabled authogrowth setting for your database files. You need to enable it by launching database property window. You can click on three dots next to each database files in column “Authogrowth/Maxsize” and click at the enable authogrowth checkbox as showing in below screenshot.</p>
<p><img loading="lazy" decoding="async" class="size-full wp-image-1994 aligncenter" src="http://techyaz.com/wp-content/uploads/2018/03/3-Autogrowth-min.jpg" alt="Enable Autogrowth" width="701" height="631" srcset="https://techyaz.com/wp-content/uploads/2018/03/3-Autogrowth-min.jpg 701w, https://techyaz.com/wp-content/uploads/2018/03/3-Autogrowth-min-300x270.jpg 300w" sizes="auto, (max-width: 701px) 100vw, 701px" /></p>
<p>You can also use ALTER statement to enable database autogrowth setting for your database file. Remember, you need to run this ALTER statement for each database file separately.</p>
<p>Run below ALTER command to enable autogrowth for database file.</p>
<pre><span style="color: #008000;"><strong>--Pass logical filename of your database file for under NAME section.</strong></span>
<span style="color: #0000ff;"><strong>ALTER DATABASE [Techyaz] MODIFY FILE ( NAME = N'Techyaz_Data', FILEGROWTH = 10000KB )</strong></span></pre>
<p>Make sure to enable Instant File Initialization to speedup autogrowth operations. Links to enable Instant File Initialization is attached in this article.</p>
<p>If you are facing this issue for tempdb database then you can consider one more option apart from all of the above options. And this option is to restart SQL Server service if it&#8217;s allowed. Keep in mind, SQL Server service restart will cause an outage for few minutes but it will create new tempdb files with initial size and error 1101 will be disappeared. This is not recommended solution because of outage so you should work on long terms solutions.</p>
<p>You can also use above solutions to fix error 1105 that is very much similar to error 1101. 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/troubleshooting/fix-msg-5144-and-5145-for-long-or-failed-autogrow/" target="_blank" rel="noopener">Fix Error 5144 and Error 5145 for Long or Failed Autogrow of Database Files</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">Understanding Autogrowth Operation in SQL Server Databases</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">How to Enable IFI &#8211; Instant File Initialization?</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/troubleshooting/manage-transaction-log-file-during-data-load/" target="_blank" rel="noopener">Manage Database Files during huge Data Load</a></strong></li>
</ul>
<p>The post <a href="https://techyaz.com/sql-server/troubleshooting/fix-error-1101-could-not-allocate-a-new-page-for-database/">Fix Error 1101: Could not allocate a new page for database</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/troubleshooting/fix-error-1101-could-not-allocate-a-new-page-for-database/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<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 loading="lazy" 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="auto, (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>How to Improve SQL Server Bulk Data Import Performance?</title>
		<link>https://techyaz.com/sql-server/performance-tuning/improve-sql-server-bulk-data-import-performance/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/improve-sql-server-bulk-data-import-performance/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Wed, 08 Nov 2017 07:24:07 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[Auto shrink]]></category>
		<category><![CDATA[autogrow]]></category>
		<category><![CDATA[autogrowth setting]]></category>
		<category><![CDATA[Autoshrink]]></category>
		<category><![CDATA[batch size]]></category>
		<category><![CDATA[bulk data load]]></category>
		<category><![CDATA[bulk import]]></category>
		<category><![CDATA[bulk import performance]]></category>
		<category><![CDATA[bulk insert]]></category>
		<category><![CDATA[data file]]></category>
		<category><![CDATA[data file autogrow]]></category>
		<category><![CDATA[data load]]></category>
		<category><![CDATA[database property]]></category>
		<category><![CDATA[HowTO]]></category>
		<category><![CDATA[IFI]]></category>
		<category><![CDATA[Instant File Initialization]]></category>
		<category><![CDATA[log_files]]></category>
		<category><![CDATA[maxdop]]></category>
		<category><![CDATA[performance tuning]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1108</guid>

					<description><![CDATA[<p>I am working on a project where we are migrating Oracle databases to SQL Server for SAP applications. We are using SAP migration tools to migrate these databases and we are not using SSMA for Oracle in this migration. These&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/improve-sql-server-bulk-data-import-performance/">How to Improve SQL Server Bulk Data Import Performance?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I am working on a project where we are migrating Oracle databases to SQL Server for SAP applications. We are using SAP migration tools to migrate these databases and we are not using SSMA for Oracle in this migration. These databases were very big in size so we faced some performance issues during data load. Here I will explain how to avoid such performance issues and speed up SQL Server Bulk Data Import Performance.</p>
<p>Let me first give you some background about SAP migration tool like how it works. SAP Migration tool first captures every related information along with data and creates an export file that needs to be copied to the target location or server and then we perform bulk data import with the help of SAP migration tool. Bulk data import or data load will be done locally and not over network.</p>
<p>When we ran SAP migration tools to capture all details, a dump file was created that we have copied to the SQL Server box. We had approx. 900GB of data that needs to be loaded into SQL Server database. When we performed SQL Server data load using SAP migration tools with standard settings, it took around 14 hrs. to complete the bulk data import.  As 14 hrs. was very long time so we decided to work on reducing the total time taken by import process.</p>
<p>We made some changes from both sides application as well as SQL Server database side. SQL Server data load time has reduced drastically to around little more than 6 hours post these change implementations. Here, I am explaining each parameter that we have configured from database side just for this bulk data import.</p>
<p><span style="color: #800000;"><strong>NOTE:</strong> </span>Make sure to revert these changes as per your application/vendor best practices post this bulk data import for OLTP/normal operations. We are changing value considering Data Load only.</p>
<p><img loading="lazy" decoding="async" class="alignleft wp-image-1109 size-medium" src="http://techyaz.com/wp-content/uploads/2017/11/Speed-up-bulk-data-Import-300x169.jpg" alt="Speed up bulk data Import" width="300" height="169" srcset="https://techyaz.com/wp-content/uploads/2017/11/Speed-up-bulk-data-Import-300x169.jpg 300w, https://techyaz.com/wp-content/uploads/2017/11/Speed-up-bulk-data-Import-768x432.jpg 768w, https://techyaz.com/wp-content/uploads/2017/11/Speed-up-bulk-data-Import-1024x576.jpg 1024w, https://techyaz.com/wp-content/uploads/2017/11/Speed-up-bulk-data-Import.jpg 1280w" sizes="auto, (max-width: 300px) 100vw, 300px" /></p>
<p>It is important to understand the factors that affect bulk data import performance. To speed up the data load, you need to look into below configuration options from DBA standpoint.</p>
<h5><span style="color: #000080;"><strong>Auto Grow</strong></span></h5>
<p><strong> </strong>Autogrow settings can be used to automate SQL Server database file growth. This is very useful property but this can degrade your bulk import performance or data load operations. Read attached article to<strong> <a href="https://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">understand SQL Server Autogrow setting</a> </strong>in detail.</p>
<p>Autogrow setting increment must be large enough to avoid the performance penalties.  If you set default or small value during bulk import or data load, database engine will have to perform data file autogrow operation every time the file will be filled with data till maximum size limit. More autogrow operation will take more resources like IO, CPU etc and time to complete the data load transaction.</p>
<p>The exact value for this setting should be based on data growth. You should not be left autogrow in percentage value rather you should use some value in MBs. A general rule of thumb is to set your autogrow setting to about one-eighth the size of the file. Please read attached article to understand <strong><a href="https://techyaz.com/sql-server/troubleshooting/manage-transaction-log-file-during-data-load/" target="_blank" rel="noopener">how to manage transaction log files during huge data load</a>.</strong></p>
<p>I would suggest keeping database size as much as you are expecting your database will grow to avoid autogrow operation. If you are aware that your database size will be 900 GB post data load, you should set your database size to 900 GB before starting the data load. This will improve the bulk import performance. Make sure to enable IFI (Instant File Initialization) for your SQL Server instance to reduce total time SQL Server takes to set the database size.</p>
<h5><span style="color: #000080;"><strong>Instant File Initialization</strong></span></h5>
<p>As I suggested in above point, Turn IFI (Instant File Initialization) ON to speed up AutoGrow process. If you set a considerable large value to autogrow settings, it will take some time to increase the size by zeroing the disk address. IFI speeds up this process and allow us to create enormous size of data files in quick way. Read attached article to learn more about<strong> <a href="https://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">IFI (Instant File Initialization) and how it will speed up autogrow or data load operation</a></strong>. You will also learn how to enable IFI for your SQL Server instance in this attached article.</p>
<h5><span style="color: #000080;"><strong>Auto Shrink</strong></span></h5>
<p>AutoShrink is very costly operation that should be always OFF even during your daily and normal operations. Turn it OFF immediately. Make sure your disk has enough space to sustain during bulk operations or data load. Repeatedly shrinking and growing the data files will cause file-system level fragmentation, which can slow down performance. It also takes lot of CPU and IO. Read attached article to know<strong> <a href="https://techyaz.com/sql-server/always-turn-off-database-auto-shrink/" target="_blank" rel="noopener">why you should always keep Auto_Shrink off</a>.</strong></p>
<h5><span style="color: #000080;"><strong>Reduce Logging</strong></span></h5>
<p>Change <strong><a href="https://techyaz.com/sql-server/understanding-sql-server-recovery-model/" target="_blank" rel="noopener">recovery model</a></strong> to SIMPLE or BULK-LOGGED to reduce the logging operations. The simple recovery model minimally logs most bulk operations. For a database under the full recovery model, all row-insert operations that are performed during bulk import are fully logged in the transaction log.</p>
<p>For large data imports, this can cause the transaction log to fill rapidly. For bulk-import operations, minimal logging is more efficient than full logging and reduces the possibility that a bulk-import operation will fill the log space. To minimally log a bulk-import operation on a database that normally uses the full recovery model, you can first switch the database to the bulk-logged recovery model. After bulk importing the data, switch the recovery model back to the full recovery model.</p>
<h5><span style="color: #000080;"><strong>Auto_Update_Statistics</strong></span></h5>
<p>Auto_Update_Statistics is very useful property that should be set to ON during normal business operations but here I would suggest turning it off during huge data load or bulk import operations. Updating the statistics also takes resources from the system. This can lead to performance issues when you are doing bulk data. It’s important to keep up-to-date statistics for the optimizer to use, but here we will turn it off and once data load or bulk data inserts will be performed, we will again enable it.</p>
<h5><span style="color: #000080;"><strong>Auto_Create_Statistics</strong></span></h5>
<p>This should be OFF because creating statistics also takes resources from the system that can degrade the overall bulk import performance. Make sure to enable it post data load or bulk inserts operation.</p>
<h5><span style="color: #000080;"><strong>Parallelism – MAXDOP</strong></span></h5>
<p>SAP suggests setting MAXDOP value to 1 during normal business operation so we had this value during first data load that took around 14 hrs. We had assigned half of the CPU cores for the parallel processes during data load and bulk import operations. I believe MAXDOP has contributed significant role in reducing total data load time. Make sure to revert this change to its original value as per your application best practices.</p>
<p>You can change MAXDOP settings either using <strong>sp_configure</strong> command or using GUI in SSMS by launching SQL Server Instance property window.</p>
<h5><span style="color: #000080;"><strong>Using Batches</strong></span></h5>
<p>Make sure to use an optimum batch size that will increase the bulk data import performance. Importing a large set of data as a single batch can be problematic, so bcp and BULK INSERT let you import data in a series of batches, each of which is smaller than the data file. Each batch is imported and logged in a separate transaction, and after a given transaction is committed, the rows imported by that transaction are committed. If the operation fails, only rows imported from the current batch are rolled back, and you can resume importing data starting at the beginning of the failed batch rather than at the beginning of the data file.</p>
<p>I hope you like this article. Please follow us 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/performance-tuning/improve-sql-server-bulk-data-import-performance/">How to Improve SQL Server Bulk Data Import Performance?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/performance-tuning/improve-sql-server-bulk-data-import-performance/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Why Should You Always Turn Off Database Auto Shrink Property?</title>
		<link>https://techyaz.com/sql-server/performance-tuning/always-turn-off-database-auto-shrink/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/always-turn-off-database-auto-shrink/#comments</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Wed, 27 Sep 2017 12:27:25 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[Auto shrink]]></category>
		<category><![CDATA[Autoshrink]]></category>
		<category><![CDATA[database property]]></category>
		<category><![CDATA[performance tuning]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=979</guid>

					<description><![CDATA[<p>SQL Server Auto Shrink is database property that allow database engine to automatically shrink database files if its value set to ON/True. Shrinking a database is not a good practice because it is very expensive operation in terms of I/O,&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/always-turn-off-database-auto-shrink/">Why Should You Always Turn Off Database Auto Shrink Property?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>SQL Server Auto Shrink</strong> is database property that allow database engine to automatically shrink database files if its value set to ON/True.<strong> <a href="https://techyaz.com/sql-server/avoid-database-shrink-operation/" target="_blank" rel="noopener">Shrinking a database is not a good practice</a> </strong>because it is very expensive operation in terms of I/O, CPU usage, locking and transaction log generation. Database auto shrink in SQL Server also causes your Indexes to be fragmented because it runs frequently.</p>
<p>Database Auto Shrink or Manual shrink operation runs at database file level. It is not recommended to shrink your <a href="https://techyaz.com/sql-server/understanding-sql-server-data-files-pages-extents/" target="_blank" rel="noopener">data files</a> except in case of the few exceptions like data deletion.  You can run shrink operation if you have deleted some portion of the data to reclaim that space. As this shrink operation can cause index fragmentation so make sure to rebuild your fragmented indexes post performing the shrink operation. Shrinking the <a href="https://techyaz.com/sql-server/understanding-transaction-log-architecture/" target="_blank" rel="noopener">log file</a> may be necessary in some cases if your log file is full and need to clear some space. However, <a href="https://techyaz.com/sql-server/get-total-virtual-log-files/" target="_blank" rel="noopener">shrinking the log file</a> should not be part of any regular maintenance activity and should be manually done whenever it will require.</p>
<p>It is always recommended to never run shrink operation as part of maintenance activity even you should avoid running shrink operation manually if you are doing it. If it is needed to run shrink operation, make sure rebuild your indexes. You should always turn off SQL Server Auto Shrink  for all databases to avoid any future performance issue on your database. By default, SQL Server keeps auto shrink turn off on SQL Server instances.</p>
<p>There will be a bad impact on performance if you turn on database auto shrink and <a href="https://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">autogrowth settings</a> together for any database. Most of the database files have some value to autogrowth setting enabled for the databases or we set the database size to the optimum value keeping some room in the data files to grow and avoid frequent auto growth events. If we will enable SQL Server auto shrink property for such databases, it will shrink the data files and reclaim the free space that we have kept intentionally to avoid autogrow events. In that case, both operations will be performed frequently auto growth and then SQL auto shrink that ultimately lead to the system level fragmentation which causes severe performance issue as well.</p>
<p>So in short, <strong>Autoshrink should not be turned on</strong> for any databases. This is bad for several reasons that I have concluded in below points.</p>
<ol>
<li>Database Auto Shrink or Manual Shrink causes index fragmentation that will reduce the database performance.</li>
<li>Shrink operation takes lot of IO and CPU resources. If the server is already pushing the limits of the IO subsystem, running shrink may push it over, causing long disk queue lengths and possibly IO timeouts.</li>
<li>Repeatedly shrinking and growing the data files will cause file-system level fragmentation, which can slow down performance. It wastes a huge amount of resources, basically running the shrink algorithm for no reason.</li>
<li>If you combine the <a href="https://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">autogrow</a> and autoshrink options, you might create unnecessary overhead. Make sure that the thresholds that trigger the grow and shrink operations will not cause frequent up and down size changes. So Autogrow and Autoshrink together can seriously reduce your system performance.</li>
<li>SQL Server Auto Shrink and autogrow settings must be carefully evaluated by a trained Database Administrator (DBA); they must not be left unmanaged.</li>
</ol>
<p>Autoshrink doesn&#8217;t work like if the threshold is hit, auto shrink SQL Server operation will start to reclaim space. It uses round robin method to shrink databases if you have multiple databases are set to use auto shrink. SQL Server shrinks a database if needed. Then, it waits several minutes before checking the next database that is configured for auto shrink so your database will need to wait for his turn to execute auto shrink operation.</p>
<h3><span style="color: #003366;">How to Enable or Disable Auto Shrink in SQL Server?</span></h3>
<p>We can turn on or off database auto shrink SQL Server configuration using GUI and T-SQL both ways. Both are easiest method. Let us first start with GUI method.</p>
<p><strong>Right click</strong> on your database for which you want to enable or disable auto shrink and choose <strong>Properties</strong>. You will get below <strong>Database Properties</strong> window. Click on <strong>Options</strong> from left side pane of this window. You can see <strong>Auto Shrink</strong> option is showing in right side pane. If you want to turn it on, click on drop down of this option and select <strong>True</strong>.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-982" src="http://techyaz.com/wp-content/uploads/2017/09/1-autoshrink.jpg" alt="Enable or Disable Database Auto Shrink" width="709" height="635" srcset="https://techyaz.com/wp-content/uploads/2017/09/1-autoshrink.jpg 709w, https://techyaz.com/wp-content/uploads/2017/09/1-autoshrink-300x269.jpg 300w" sizes="auto, (max-width: 709px) 100vw, 709px" /></p>
<p>Below is the T-SQL code to enable or disable the Auto_Shrink option for any database. Change the database name with your database name and execute it.</p>
<div class="codediv">
<pre><strong><span style="color: #008000;">--Set Auto Shrink ON or True</span>
<span style="color: #0000ff;">ALTER DATABASE TechYaz SET AUTO_SHRINK ON</span>
<span style="color: #008000;">--Set Auto Shrink OFF or False</span>
<span style="color: #0000ff;">ALTER DATABASE TechYaz SET AUTO_SHRINK OFF
</span></strong></pre>
</div>
<p>I hope you like this article. Please follow us on our <a href="https://www.facebook.com/Techyaz/">facebook page</a> and on <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p><span style="color: #000080;"><strong>Reference :</strong></span> <a href="https://support.microsoft.com/en-in/help/2160663/recommendations-and-guidelines-for-setting-the-auto-shrink-database-op" target="_blank" rel="noopener">AUTO_SHRINK database option in SQL Server</a></p>
<p><em><span style="color: #800000;"><strong>Read More:</strong></span></em></p>
<ul>
<li><strong><a href="https://techyaz.com/sql-server/avoid-database-shrink-operation/" target="_blank" rel="noopener">Should We Shrink SQL Server Databases or Files?</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">Understanding AutoGrowth settings and its impact on Performance</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/sql-server-administration/understanding-sql-server-backup-databases-availability-group/" target="_blank" rel="noopener">SQL Server Backups for AlwaysOn Availability Databases</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">What is Instant File Initialization and how to enable it?</a></strong></li>
</ul>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/always-turn-off-database-auto-shrink/">Why Should You Always Turn Off Database Auto Shrink Property?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/performance-tuning/always-turn-off-database-auto-shrink/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Understanding Database Autogrowth in SQL Server</title>
		<link>https://techyaz.com/sql-server/performance-tuning/understanding-database-autogrowth-sql-server/</link>
					<comments>https://techyaz.com/sql-server/performance-tuning/understanding-database-autogrowth-sql-server/#comments</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Tue, 26 Sep 2017 12:43:10 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[autogrow]]></category>
		<category><![CDATA[autogrowth setting]]></category>
		<category><![CDATA[data file autogrow]]></category>
		<category><![CDATA[database property]]></category>
		<category><![CDATA[performance tuning]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=970</guid>

					<description><![CDATA[<p>We use SQL Server database Autogrowth setting to automate database file growth. This property is very helpful if you use it carefully with proper planning. But there can be a negative performance impact on your database if you don’t give attention&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/understanding-database-autogrowth-sql-server/">Understanding Database Autogrowth in SQL Server</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We use SQL Server database <strong>Autogrowth</strong> setting to automate database file growth. This property is very helpful if you use it carefully with proper planning. But there can be a negative performance impact on your database if you don’t give attention on it and leave it with default values. If you have too many autogrow events in your database, it can degrade the overall performance of the database. Below are the points that you can consider to reduce the autogrow events in a database to improve performance.</p>
<h3><span style="color: #003366;">Set Optimum Database Size</span></h3>
<p>Your database should have enough size that it never grows and if it grows make sure that <a href="https://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">Instant file initialization</a> should be enabled on that SQL Server Instance. <strong>Autogrowth</strong> is an option that should be used to avoid unexpected scenarios of space issues in <a href="https://techyaz.com/sql-server/understanding-sql-server-data-files-pages-extents/" target="_blank" rel="noopener">database files</a>. You should plan your database size in a way that can minimize the use of autogrowth setting. You should figure out how big your database will be over the time and set the database size to that value. Analyze database size on every few months to adjust the size if it requires to increase. This way you can minimize autogrow events to be performed on your database files.</p>
<h3><span style="color: #003366;">Resize Database Autogrowth in SQL Server</span></h3>
<p>Auto growth events are expensive operations that slow down the performance of your database because whenever an auto-growth event is performed, SQL Server holds up database processing. This equates to slower response time for those SQL commands that are being processing against the database that is growing.</p>
<p>If you run a large transaction that requires the log to grow, other transactions that require a write to the <a href="https://techyaz.com/sql-server/understanding-transaction-log-architecture/" target="_blank" rel="noopener">transaction log</a> will also have to wait until the autogrow operation completes. If your database is performing frequent autogrow events, then you have a good scope of performance improvement by proper resizing the database autogrowth settings that will reduce the number of autogrow events to be occurred.</p>
<p>Another negative side of autogrowth is the disk fragmentation. The more autogrow events you have the more physical fragmentation you will have. When your database is physically fragmented, it will take more time for SQL Server to read that databases. To avoid the issues associated with auto-growth events you need to minimize the number of its occurrence.</p>
<p><span style="color: #4d4545;"><strong><em>Change Default Autogrowth Settings</em></strong></span></p>
<p>As per my experience, never leave your database files with the default autogrowth settings. The autogrowth default value for data files is 1MB and log files is 10% of total size of the log file. These autogrowth values are inherited from model database. You can change the autogrowth size of each database file of model database that will apply on all databases we create on this SQL Server Instance.</p>
<p><strong>For example:</strong> You can change autogrow settings from default value that is 1MB to <strong>one-eighth</strong> of the database file size. This will again reduce the total number of autogrow events of the database. Make sure that Instant file initialization should be enabled on that SQL Server Instance.</p>
<h3><span style="color: #003366;">Monitoring</span></h3>
<p>If you know your database growth pattern, then set autogrowth per that growth. If you don’t have any idea about your future database growth, then you should proactively monitor database file sizes and their autogrowth events for a week or month and then set it per the growth pattern. We should also proactively monitor database growth histories for all databases to avoid any future outages due to disk or database file full.</p>
<p>You can analyze database disk usage dashboard report to get the number of times autogrowth event has occurred for your database files. I have explained this later in this article.</p>
<h3><span style="color: #003366;">Best Practices for Database Autogrowth in SQL Server</span></h3>
<p>You can improve the database performance and can manage the disk space utilization by focusing on below four points. This will also reduce the number of Autogrowth events to be occurred in the database files.</p>
<ol>
<li>Analyze your database growth pattern and set optimum size of database with the analyzed growth settings. Your database should have enough size that it never grows and if it grows make sure that<strong> <a href="https://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">Instant file initialization should be enabled on that SQL Server Instance</a></strong>.  This will drastically reduce the SQL Server Autogrowth events in day to day life.</li>
<li>Proactively monitor database file sizes and their autogrowth events. This helps you to analyze the growth pattern of database files and avoid fragmentation.</li>
<li>Consider defragmenting your database file system if you have lot of auto-growth events occurred on your databases.</li>
<li>Never leave your database autogrowth with default values, change it as per growth pattern that you analyzed over time.</li>
<li>Avoid using autogrowth in percentage, rather give a specific amount of size in MB/GB. Microsoft suggests to set your autogrow setting to about one-eighth the size of the file and test it before deploying on PROD.</li>
<li>Turn on the &lt;MAXSIZE&gt; setting for each file to prevent any one file from growing to a point where it uses up all available disk space.</li>
<li>The growth increment of your transaction log must be large enough to stay ahead of the needs of your transaction units. Even with autogrow turned on, you can receive a message that the transaction log is full, if it cannot grow fast enough to satisfy the needs of your query.</li>
</ol>
<h3><span style="color: #003366;">Change Database Autogrowth in SQL Server?</span></h3>
<p>You can run below command to change the autogrowth value of any database file.</p>
<pre><strong><span style="color: #008000;">--Pass logical filename of your database file for under NAME section.</span>
<span style="color: #0000ff;">ALTER DATABASE [Techyaz] MODIFY FILE ( NAME = N'Techyaz_Data', FILEGROWTH = 10000KB )
</span></strong></pre>
<p>You can also change the autogrowth settings using GUI in SSMS. Launch the database property window. Click on files tab from left side pane and then on the three dots (…) that are showing besides every database file. You can see this window in below screenshot.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-974" src="http://techyaz.com/wp-content/uploads/2017/09/1-autogrowth.jpg" alt="Autogrowth Settings" width="707" height="627" srcset="https://techyaz.com/wp-content/uploads/2017/09/1-autogrowth.jpg 707w, https://techyaz.com/wp-content/uploads/2017/09/1-autogrowth-300x266.jpg 300w" sizes="auto, (max-width: 707px) 100vw, 707px" /></p>
<h3><span style="color: #003366;">How to View Total Number of Autogrow Events Occurred on a Database?</span></h3>
<p>You can find the number of autogrowth events occurred for your database by running “Disk Usage” dashboard report. Right click on your database for which you want to see total number of autogrowth events. Choose “Reports” and then select “Disk Usage” as shown in below image.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-973" src="http://techyaz.com/wp-content/uploads/2017/09/2-dashboard-report.jpg" alt="Open dashboard Report" width="847" height="299" srcset="https://techyaz.com/wp-content/uploads/2017/09/2-dashboard-report.jpg 847w, https://techyaz.com/wp-content/uploads/2017/09/2-dashboard-report-300x106.jpg 300w, https://techyaz.com/wp-content/uploads/2017/09/2-dashboard-report-768x271.jpg 768w" sizes="auto, (max-width: 847px) 100vw, 847px" /></p>
<p>You will get below dashboard report for disk usage. You can see all details regarding space usage. Auto growth events are also captured in the same report. I have highlighted those entries in below screenshot.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-972" src="http://techyaz.com/wp-content/uploads/2017/09/3-dashboard-report.jpg" alt="disk usage dashboard Report" width="841" height="429" srcset="https://techyaz.com/wp-content/uploads/2017/09/3-dashboard-report.jpg 841w, https://techyaz.com/wp-content/uploads/2017/09/3-dashboard-report-300x153.jpg 300w, https://techyaz.com/wp-content/uploads/2017/09/3-dashboard-report-768x392.jpg 768w" sizes="auto, (max-width: 841px) 100vw, 841px" /></p>
<p>Once you expend the plus<strong> +</strong> sign, you can see total number of autogrow events that have been occurred for your database. You can count the total numbers and total space as well. Based on this analysis you can alter your autogrowth settings to the optimum value that will reduce that much numbers as it is showing here.<br />
<img loading="lazy" decoding="async" class="aligncenter size-full wp-image-971" src="http://techyaz.com/wp-content/uploads/2017/09/4-autogrowth-events.jpg" alt="database autogrowth events" width="787" height="523" srcset="https://techyaz.com/wp-content/uploads/2017/09/4-autogrowth-events.jpg 787w, https://techyaz.com/wp-content/uploads/2017/09/4-autogrowth-events-300x199.jpg 300w, https://techyaz.com/wp-content/uploads/2017/09/4-autogrowth-events-768x510.jpg 768w" sizes="auto, (max-width: 787px) 100vw, 787px" /><br />
I hope you like this article. Please follow us on our <a href="https://www.facebook.com/Techyaz/">facebook page</a> and on <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p><span style="color: #000080;"><strong>Reference:</strong> <a href="https://support.microsoft.com/en-in/help/315512/considerations-for-the-autogrow-and-autoshrink-settings-in-sql-server" target="_blank" rel="noopener">MSDN Article based on Autogrowth</a></span></p>
<p>The post <a href="https://techyaz.com/sql-server/performance-tuning/understanding-database-autogrowth-sql-server/">Understanding Database Autogrowth in SQL Server</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/performance-tuning/understanding-database-autogrowth-sql-server/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
