<?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>Instant File Initialization - Techyaz.com</title>
	<atom:link href="https://techyaz.com/tag/instant-file-initialization/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Tips, Tutorials and How-to Topics</description>
	<lastBuildDate>Fri, 23 Jul 2021 12:29:27 +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>Instant File Initialization - Techyaz.com</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Fix SQL Server Msg 5144 and 5145 for long or failed autogrow of data and log files</title>
		<link>https://techyaz.com/sql-server/troubleshooting/fix-msg-5144-and-5145-for-long-or-failed-autogrow/</link>
					<comments>https://techyaz.com/sql-server/troubleshooting/fix-msg-5144-and-5145-for-long-or-failed-autogrow/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Wed, 24 Jan 2018 16:19:30 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[autogrow]]></category>
		<category><![CDATA[autogrowth setting]]></category>
		<category><![CDATA[data file autogrow]]></category>
		<category><![CDATA[IFI]]></category>
		<category><![CDATA[Instant File Initialization]]></category>
		<category><![CDATA[log_files]]></category>
		<category><![CDATA[SQL_Error_Code]]></category>
		<category><![CDATA[transaction log]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1634</guid>

					<description><![CDATA[<p>Whenever you extend the size of your data or log file with a larger value or your database perform autogrow operation to extend its database files with bigger value then SQL Server takes longer time to perform such activities. SQL&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/troubleshooting/fix-msg-5144-and-5145-for-long-or-failed-autogrow/">Fix SQL Server Msg 5144 and 5145 for long or failed autogrow of data and log files</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Whenever you extend the size of your data or log file with a larger value or your database perform autogrow operation to extend its database files with bigger value then SQL Server takes longer time to perform such activities. SQL Server reports these messages 5144 and 5145 in to the Application Event Log and ERRORLOG in case autogrow of a database and/or transaction log file has timed out or has taken a long period of time to complete. The details about such logs are given below:</p>
<p><em><span style="color: #ff0000;">Msg 5144</span></em><br />
<em><span style="color: #ff0000;"> Autogrow of file &#8216;Data or Log file name&#8217; in database &#8216;Database&#8217; was cancelled by user or timed out after &lt;n&gt; milliseconds. Use ALTER DATABASE to set a smaller FILEGROWTH value for this file or to explicitly set a new file size.</span></em></p>
<p>Or you will get below message if autogrow operation or data/log file size increase operation will run for longer duration than expected.</p>
<p><em><span style="color: #ff0000;">Msg 5145</span></em><br />
<em><span style="color: #ff0000;"> Autogrow of file &#8216;Data or Log file name&#8217; in database &#8216;Database&#8217; took &lt;n&gt; milliseconds. Consider using ALTER DATABASE to set a smaller FILEGROWTH for this file.</span></em></p>
<p>Whenever data or log file growth operation is taking lot of time then a wait type <a href="http://techyaz.com/sql-server/reduce-wait-type-preemptive_os_writefilegather/" target="_blank" rel="noopener">PREEMPTIVE_OS_WRITEFILEGATHER</a> will be shown in to SQL Server. If you want to read more about this wait type then click at the attached link.<strong> </strong></p>
<h3><span style="color: #333399;">Root Cause</span></h3>
<p>Data and log file initialization takes lot of time if you have to create large database files or large data or log file growth will be performed. Whenever we allocate or extend space to data or log file, it first fills with zeros. Zeroing operation takes lot of time for bigger size autogrowth operations that causes for longer run to complete. We generally see these messages (5144 or 5145) during either extending the data or transaction log files or during autogrowth operation for data or log files.</p>
<p><img fetchpriority="high" decoding="async" class="size-full wp-image-1637 alignleft" src="http://techyaz.com/wp-content/uploads/2018/01/Fix-msg-5144-5145-min.png" alt="fix msg 5144 and 5145" width="560" height="315" srcset="https://techyaz.com/wp-content/uploads/2018/01/Fix-msg-5144-5145-min.png 560w, https://techyaz.com/wp-content/uploads/2018/01/Fix-msg-5144-5145-min-300x169.png 300w" sizes="(max-width: 560px) 100vw, 560px" /></p>
<p>Microsoft has given a solution named <a href="http://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">Instant File Initialization</a> to fix the time consuming file size allocation for data files. Once Instant File Initialization will be enabled, your data files size allocation will be done in faster way but unfortunately Instant File Initialization does not work on transaction log files.  <strong>Instant file initialization</strong> reclaims used disk space without filling that space with zeros. Instead, disk content is overwritten as new data is written to the files. Read below section to overcome these error messages.</p>
<h3><span style="color: #333399;">Solution</span></h3>
<p>To avoid these messages 5144 or 5145 to be logged, we should plan file size growth carefully. We should set maximum size of the database so that it could not perform frequent autogrowth operation. We can enable Instant File Initialization feature to speed up the data file size allocation. It is not recommended to rely on autogrowth of files as standard operation for obtaining more space in a file. Rather, you should plan out the maximum size of your database and/or transaction log file and allow autogrowth to occur only in unplanned situations for space. Follow below points to avoid this error.</p>
<ul>
<li>Enable Instant File Initialization to speed up data file size allocation. Read attached article to <a href="http://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">enable IFI (Instant File Initialization) on your database server</a>.</li>
<li>As IFI (Instant File Initialization) does not work on log files so we need to set log files in smaller chunks to avoid any time out error or longer runs.</li>
<li>Set database size to the maximum size it could be and allow autogrowth settings to occur only in unplanned situations for space.Read attached article to <a href="http://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">understand Autogrowth setting and its perfect value for database files.</a></li>
</ul>
<p>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>Related Articles:</strong></em></span></p>
<ul>
<li><span style="color: #0000ff;"><strong><a style="color: #0000ff;" href="http://techyaz.com/sql-server/troubleshooting/manage-transaction-log-file-during-data-load/" target="_blank" rel="noopener">Manage Transaction Log File during Data Load</a></strong></span></li>
<li><span style="color: #0000ff;"><strong><a style="color: #0000ff;" href="http://techyaz.com/sql-server/improve-sql-server-bulk-data-import-performance/" target="_blank" rel="noopener">How to Improve Bulk Data Load Performance?</a></strong></span></li>
<li><span style="color: #0000ff;"><strong><a style="color: #0000ff;" href="http://techyaz.com/sql-server/reduce-wait-type-preemptive_os_writefilegather/" target="_blank" rel="noopener">How to Reduce SQL Server Wait type PREEMPTIVE_OS_WRITEFILEGATHER?</a></strong></span></li>
<li><span style="color: #0000ff;"><strong><a style="color: #0000ff;" 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></span></li>
<li><span style="color: #0000ff;"><strong><a style="color: #0000ff;" 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></span></li>
</ul>
<p>The post <a href="https://techyaz.com/sql-server/troubleshooting/fix-msg-5144-and-5145-for-long-or-failed-autogrow/">Fix SQL Server Msg 5144 and 5145 for long or failed autogrow of data and log files</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/troubleshooting/fix-msg-5144-and-5145-for-long-or-failed-autogrow/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Reduce PREEMPTIVE_OS_WRITEFILEGATHER Wait Type in SQL Server?</title>
		<link>https://techyaz.com/sql-server/wait-types/reduce-wait-type-preemptive_os_writefilegather/</link>
					<comments>https://techyaz.com/sql-server/wait-types/reduce-wait-type-preemptive_os_writefilegather/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Tue, 16 Jan 2018 09:04:35 +0000</pubDate>
				<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Wait Types]]></category>
		<category><![CDATA[autogrowth setting]]></category>
		<category><![CDATA[data file autogrow]]></category>
		<category><![CDATA[IFI]]></category>
		<category><![CDATA[Instant File Initialization]]></category>
		<category><![CDATA[Waittypes]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1496</guid>

					<description><![CDATA[<p>I was getting wait type PREEMPTIVE_OS_WRITEFILEGATHER during database size allocation. Yesterday, I was configuring database size to the value that was suggested by the vendor. We need to set database size to 700GB keeping 150 GB to log files. I&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/wait-types/reduce-wait-type-preemptive_os_writefilegather/">How to Reduce PREEMPTIVE_OS_WRITEFILEGATHER Wait Type in SQL Server?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I was getting wait type <em>PREEMPTIVE_OS_WRITEFILEGATHER</em> during database size allocation. Yesterday, I was configuring database size to the value that was suggested by the vendor. We need to set database size to 700GB keeping 150 GB to log files. I have successfully configured data files sizes in less than 2 minutes because we had already enabled <a href="http://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">Instant File Initialization</a>. As we know Instant File Initialization (IFI) speeds up the data file size allocation by skipping the zero-initialize operation. But when i started extending log file sizes, it took lot of time. One reason for taking longer time might be because of wait type <em>PREEMPTIVE_OS_WRITEFILEGATHER</em> that was showing for the session id that was running to allocate log file space.</p>
<h4><span style="color: #333399;">What is PREEMPTIVE_OS_WRITEFILEGATHER?</span></h4>
<p>As per MSDN, <em>PREEMPTIVE_OS_WRITEFILEGATHER</em> is a wait type that occurs while SQL Server is waiting for the Operating System to complete portions of write operations. This wait is commonly seen in databases with <a href="http://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">auto-growth not configured appropriately</a> or during large size allocation to database files. If you are getting this wait type frequently then you should investigate your SQL Server instance. You can also observe this wait type along with <a href="http://techyaz.com/sql-server/backupbuffer-wait-type/" target="_blank" rel="noopener">BACKUPBUFFER</a>  and LOGBUFFER wait types.</p>
<p><img decoding="async" class="size-full wp-image-1498 alignleft" src="http://techyaz.com/wp-content/uploads/2018/01/PREEMPTIVE_OS_WRITEFILEGATHER-min.png" alt="PREEMPTIVE_OS_WRITEFILEGATHER" width="560" height="315" srcset="https://techyaz.com/wp-content/uploads/2018/01/PREEMPTIVE_OS_WRITEFILEGATHER-min.png 560w, https://techyaz.com/wp-content/uploads/2018/01/PREEMPTIVE_OS_WRITEFILEGATHER-min-300x169.png 300w" sizes="(max-width: 560px) 100vw, 560px" /></p>
<p>Sometimes, we get this wait type during database restore operation as well. As we know backup operation captures details like database file sizes irrespective of how much data or logs filled inside the data or log file. When you execute restore operation, it will create that much big file and it will take more time because SQL Server will be busy in zeroing out the file equivalent to source data or log file size. If you have enabled IFI on your database server then you will not be getting this wait type for data files but still you might get it for log file size allocation.</p>
<p>Suppose your database has 100GB of log file and only 12 GB is filled. If you take backup of this database and restore it anywhere then restore operation will create a log file of 100GB that will take lot much time because of zero initialized operation to be performed for all 100GB size.</p>
<h4><span style="color: #333399;">Solutions to Reduce Wait Type PREEMPTIVE_OS_WRITEFILEGATHER</span></h4>
<p>Microsoft has given a feature Instant File Initialization to overcome or reduce this wait type but this feature works for only data files not log files. We hope this feature will work on both data as well as log files in future releases of SQL Servers.</p>
<p>If you are getting this wait type during extending data files or during data file autogrowth then you can simply enable Instant File Initialization on your SQL Server database server and this wait type will disappear from next time. This feature will skip zero-initialization of data files and directly allocate given size to the data files. Read attached article to <a href="http://techyaz.com/sql-server/instant-file-initialization-enable-on-sql-server-instance/" target="_blank" rel="noopener">learn Instant File Initialization and how to enable it on your SQL Server Instance</a>?</p>
<p>But we know this feature does not work on log files so we cannot use this feature to reduce this wait type if it occurs during extending log file or during log file autogrowth. We faced same issue because we had already enabled Instant File Initialization for data files but stuck during extending log files. Here I will give you few best practices that you can apply to avoid and reduce this wait type.</p>
<ol>
<li>Increase auto-growth from the default value to some numeric value to reduce the frequent auto-growth occurrence for your database file. Thumb rule is to keep autogrowth size one eight of the corresponding database-file size. Read this article to know the <a href="http://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">Perfect value for database file Autogrowth?</a></li>
<li>If possible avoid auto-growth occurrence by allocating expected size grown in future to the database.</li>
<li>Monitor Storage subsystems and Investigate if any issues identified. Upgrade Storage if required.</li>
<li>Have a look at the Windows Event Viewer for any system related issues.</li>
<li>Enable Instant File Initialization to avoid zero-initialization for data files.</li>
<li>Consolidate transactions from row-by-row statements to batch processing.</li>
<li>If you have bigger log file having small number of logs filled inside. You can <a href="http://techyaz.com/sql-server/sql-server-dmvs/4-different-usages-dbcc-sqlperf-sql-server/" target="_blank" rel="noopener">check log file size using DBCC SQLPERF command</a> given in attached article. You can shrink the log file and take the backup again to perform the restore. This should be a quick process rather than waiting for zeroing to complete for previous size of log file.</li>
<li>Stop any activity to free-up the target disk&#8217;s header so that it can dedicatedly work on zeroing out the LDF file.</li>
</ol>
<p><span style="color: #800000;"><em><strong>Read More:</strong></em></span></p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/improve-sql-server-bulk-data-import-performance/" target="_blank" rel="noopener">How to Speed up Huge Data Load in SQL Server?</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/async_io_completion-wait-type/" target="_blank" rel="noopener">Understanding ASYNC_IO_COMPLETION Wait Type</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 Transaction Log File during Data Load</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/what-is-sql-server-wait-type-or-how-to-get-wait-type-info-in-sql-server/" target="_blank" rel="noopener">Understanding SQL Server Wait Types</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/resource_semaphore-wait-type/" target="_blank" rel="noopener">How to reduce RESOURCE_SEMAPHORE wait type?</a></strong></li>
</ul>
<p>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/wait-types/reduce-wait-type-preemptive_os_writefilegather/">How to Reduce PREEMPTIVE_OS_WRITEFILEGATHER Wait Type 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/wait-types/reduce-wait-type-preemptive_os_writefilegather/feed/</wfw:commentRss>
			<slash:comments>0</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 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="(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>What is Instant File Initialization and How to enable it on SQL Server Instance?</title>
		<link>https://techyaz.com/sql-server/sql-server-administration/instant-file-initialization-enable-on-sql-server-instance/</link>
					<comments>https://techyaz.com/sql-server/sql-server-administration/instant-file-initialization-enable-on-sql-server-instance/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Thu, 07 Sep 2017 08:40:38 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[data file]]></category>
		<category><![CDATA[HowTO]]></category>
		<category><![CDATA[Instant File Initialization]]></category>
		<category><![CDATA[SQL Server Configuration Manager]]></category>
		<category><![CDATA[SQL_Server_Architecture]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=820</guid>

					<description><![CDATA[<p>Instant file initialization is very useful feature to speedup the process of increasing or allocating data file space of a SQL Server database. Have you ever thought how SQL Server initialized its database files during space allocation? General way to&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/sql-server-administration/instant-file-initialization-enable-on-sql-server-instance/">What is Instant File Initialization and How to enable it on SQL Server Instance?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>Instant file initialization</strong> is very useful feature to speedup the process of increasing or allocating data file space of a SQL Server database. Have you ever thought how SQL Server initialized its database files during space allocation? General way to initialize any data and log files is to filling the files with zeros to overwrite any existing data left on the disk from previously deleted files. Data and log file initialization happen during space allocation activities such as database creation, adding any database files, Autogrow operation or increasing the size of any database files and backup file creating.</p>
<p>Read more about auto growth and auto shrink operation in SQL Server. Both are very important activity you should review to improve your database performance.</p>
<ul>
<li><strong><a href="https://techyaz.com/sql-server/understanding-database-autogrowth-sql-server/" target="_blank" rel="noopener">Understanding Database Autogrowth in SQL Server</a></strong></li>
<li><strong><a href="https://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>
<h2>What is Instant File Initialization?</h2>
<p>Data and log file initialization takes lot of time if you have to create large database files. This can also increase total completion time of large database restore or large amount of data import to the SQL Server. Microsoft has given a feature called <strong>Instant file initialization</strong> that allows fast data file allocations for all data file operations. This feature reclaims used disk space without filling that space with zeros. Instead, disk content is overwritten as new data is written to the files. But unfortunately, this feature <strong>doesn&#8217;t work with log files</strong> so they cannot be initialized instantaneously. This is not enterprise feature any SQL Server edition can use it.</p>
<p>As we know <strong>DELETE operation</strong> deallocates the space and a new allocation can reuse that space which may still have data in it. When we do not zero out the existing space in case of instant file initialization there is a possibility that someone could read data that you thought had been deleted. This is a <strong>known security risk</strong> of this feature that must be considered while enabling it for your SQL Server Instance. Instant File Initialization is not enabled by default in SQL Server because of this security risk.</p>
<h3>Enable Instant File Initialization for SQL Server?</h3>
<p>Below are the steps you need to perform to enable Instant File Initialization.</p>
<p><strong>Step 1-</strong> Login to server where you want to enable Instant File Initialization. This might be your database server or backup server.<br /><strong>Step 2-</strong> Open the <strong>Local Security Policy</strong> application. You can go to <strong>Control Panel-&gt;Administrative Tools-&gt;Local Security Policy</strong>. You can also open it directly by putting <strong>secpol.msc</strong> into run command prompt.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-821" src="http://techyaz.com/wp-content/uploads/2017/09/1-run.jpg" alt="Open Local Security Policy by running secpol.msc" width="461" height="241" srcset="https://techyaz.com/wp-content/uploads/2017/09/1-run.jpg 461w, https://techyaz.com/wp-content/uploads/2017/09/1-run-300x157.jpg 300w" sizes="auto, (max-width: 461px) 100vw, 461px" /></p>
<p><strong>Step 3-</strong> In the left pane, expand <strong>Local Policies</strong>, and then click <strong>User Rights Assignment</strong>.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-822" src="http://techyaz.com/wp-content/uploads/2017/09/2-local-policy.jpg" alt="local security policy " width="664" height="576" srcset="https://techyaz.com/wp-content/uploads/2017/09/2-local-policy.jpg 664w, https://techyaz.com/wp-content/uploads/2017/09/2-local-policy-300x260.jpg 300w" sizes="auto, (max-width: 664px) 100vw, 664px" /><br /><strong>Step 4-</strong> In the right pane, double-click <strong>Perform volume maintenance tasks</strong>.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-823" src="http://techyaz.com/wp-content/uploads/2017/09/3-local-policy.jpg" alt="Enable Instant file Initialization" width="558" height="542" srcset="https://techyaz.com/wp-content/uploads/2017/09/3-local-policy.jpg 558w, https://techyaz.com/wp-content/uploads/2017/09/3-local-policy-300x291.jpg 300w" sizes="auto, (max-width: 558px) 100vw, 558px" /><br /><strong>Step 5-</strong> Click <strong>Add User or Group</strong> and add any user accounts that are used to run SQL Server services. You can get SQL Server service account from SQL Server Configuration Manager or from services.msc console.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-824" src="http://techyaz.com/wp-content/uploads/2017/09/4-sql-services.jpg" alt="SQL Server Services" width="739" height="273" srcset="https://techyaz.com/wp-content/uploads/2017/09/4-sql-services.jpg 739w, https://techyaz.com/wp-content/uploads/2017/09/4-sql-services-300x111.jpg 300w" sizes="auto, (max-width: 739px) 100vw, 739px" /></p>
<p>Now add account <strong>Domain\techyaz</strong> to above policy. It would be great if you create a group and add this account to that group and then add that group to given policy so that every time you don&#8217;t need to add user account here if SQL Server service account got changed.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-825" src="http://techyaz.com/wp-content/uploads/2017/09/5-local-policy.jpg" alt="" width="495" height="525" srcset="https://techyaz.com/wp-content/uploads/2017/09/5-local-policy.jpg 495w, https://techyaz.com/wp-content/uploads/2017/09/5-local-policy-283x300.jpg 283w" sizes="auto, (max-width: 495px) 100vw, 495px" /><br /><strong>Step 6-</strong> Once SQL Server service account will be added, it will look like below image. Click <strong>Apply</strong>, and then close all Local Security Policy dialog boxes.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-826" src="http://techyaz.com/wp-content/uploads/2017/09/6-local-policy.jpg" alt="" width="453" height="523" srcset="https://techyaz.com/wp-content/uploads/2017/09/6-local-policy.jpg 453w, https://techyaz.com/wp-content/uploads/2017/09/6-local-policy-260x300.jpg 260w" sizes="auto, (max-width: 453px) 100vw, 453px" /><br /><strong>Step 7-</strong> <strong>Restart</strong> SQL Server services to apply this change.</p>
<p>If you need to enable this feature on Cluster environment, make sure to perform this activity on all cluster nodes. If you are running with multiple SQL Server Instances, add all required security logins/group to this policy.</p>
<h3>How to Check If instant file initialization is Enabled Or Not?</h3>
<p>Now if you think <strong>how to know Instant File Initialization is enabled on your SQL Server</strong> Instance then here is the answer. You should check SQL Server logs to get the details about Instant File Initialization. When SQL Server service starts, database engine checks all details of SQL Server configurations and capture them into log file. You can see my error log file after restarting SQL Server service. Instant File Initialization is showing as enabled on this server.</p>
<pre class="brush: sql; title: ; notranslate" title=""><span style="color: #0000ff;"><strong>2017-06-16 11:16:49.15 Server Database Instant File Initialization: enabled. </strong></span><span style="color: #0000ff;"><strong>For security and performance considerations see the topic ‘Database Instant File Initialization’ in SQL Server Books Online. This </strong></span><span style="color: #0000ff;"><strong>is an informational message only. No user action is required.
</strong></span></pre>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-827" src="http://techyaz.com/wp-content/uploads/2017/09/7-Instant-file-initilization-enabled-log-1024x238.jpg" alt="instant file initialization in sql server log file" width="1024" height="238" srcset="https://techyaz.com/wp-content/uploads/2017/09/7-Instant-file-initilization-enabled-log-1024x238.jpg 1024w, https://techyaz.com/wp-content/uploads/2017/09/7-Instant-file-initilization-enabled-log-300x70.jpg 300w, https://techyaz.com/wp-content/uploads/2017/09/7-Instant-file-initilization-enabled-log-768x179.jpg 768w, https://techyaz.com/wp-content/uploads/2017/09/7-Instant-file-initilization-enabled-log.jpg 1091w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></p>
<h3><span style="color: #000080;">Advantages</span></h3>
<p>Instant File Initialization improves performance of multiple database activities where large size of data file creation or Autogrow operation will perform. This can vastly speed up these operations as zero-initialization can take a long time for large files. Below are the operations that can take advantage from this feature.</p>
<ul>
<li>Data Load/Import</li>
<li>New Database Creation</li>
<li>Database Restore</li>
<li>Autogrow Operation</li>
<li>Data file size Increase</li>
<li>Backup file Creation</li>
</ul>
<h3><span style="color: #000080;">Limitations</span></h3>
<p>This feature will not work if:</p>
<ul>
<li>Your file is a log file.</li>
<li>The account has not the required privilege.</li>
<li>It is a sparse file &#8211; Database Snapshots.</li>
<li>Transparent Data Encryption (TDE) is enabled.</li>
<li>Trace flag 1806 is enabled to disable instant file initialization.</li>
</ul>
<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><em><strong>Read More: </strong></em></p>
<ul>
<li><strong><a href="https://techyaz.com/sql-server/troubleshooting/fix-sql-server-error-5009/" target="_blank" rel="noopener">SQL Server Error 5009: One or more files listed in the statement could not be found or could not be initialized</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/troubleshooting/fix-msg-5144-and-5145-for-long-or-failed-autogrow/" target="_blank" rel="noopener">Fix SQL Server Msg 5144 and 5145 for long or failed autogrow of data and log files</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/troubleshooting/manage-transaction-log-file-during-data-load/" target="_blank" rel="noopener">Manage Transaction Log File during Data Load</a></strong></li>
</ul>


<p></p>
<p>The post <a href="https://techyaz.com/sql-server/sql-server-administration/instant-file-initialization-enable-on-sql-server-instance/">What is Instant File Initialization and How to enable it on SQL Server Instance?</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/sql-server-administration/instant-file-initialization-enable-on-sql-server-instance/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
