<?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>error &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/error/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Sun, 25 Sep 2016 20:31:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server: Error Msg 5009-One or more files listed in the statement could not be found or could not be initialized</title>
		<link>https://www.dbrnd.com/2016/11/sql-server-error-msg-5009-one-or-more-files-listed-in-the-statement-could-not-be-found-or-could-not-be-initialized/</link>
					<comments>https://www.dbrnd.com/2016/11/sql-server-error-msg-5009-one-or-more-files-listed-in-the-statement-could-not-be-found-or-could-not-be-initialized/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 13 Nov 2016 16:16:44 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3402</guid>

					<description><![CDATA[In this post, I am going to share one of the solution for SQL Server error like, One or more files listed in the statement could not be found or could not be initialized. Today morning, I was doing backup and restore exercise for one my report database. Generally, this database has one attached .mdf [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-server-error-msg-5009-one-or-more-files-listed-in-the-statement-could-not-be-found-or-could-not-be-initialized%2F&amp;linkname=SQL%20Server%3A%20Error%20Msg%205009-One%20or%20more%20files%20listed%20in%20the%20statement%20could%20not%20be%20found%20or%20could%20not%20be%20initialized" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-server-error-msg-5009-one-or-more-files-listed-in-the-statement-could-not-be-found-or-could-not-be-initialized%2F&amp;linkname=SQL%20Server%3A%20Error%20Msg%205009-One%20or%20more%20files%20listed%20in%20the%20statement%20could%20not%20be%20found%20or%20could%20not%20be%20initialized" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-server-error-msg-5009-one-or-more-files-listed-in-the-statement-could-not-be-found-or-could-not-be-initialized%2F&amp;linkname=SQL%20Server%3A%20Error%20Msg%205009-One%20or%20more%20files%20listed%20in%20the%20statement%20could%20not%20be%20found%20or%20could%20not%20be%20initialized" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-server-error-msg-5009-one-or-more-files-listed-in-the-statement-could-not-be-found-or-could-not-be-initialized%2F&amp;linkname=SQL%20Server%3A%20Error%20Msg%205009-One%20or%20more%20files%20listed%20in%20the%20statement%20could%20not%20be%20found%20or%20could%20not%20be%20initialized" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-server-error-msg-5009-one-or-more-files-listed-in-the-statement-could-not-be-found-or-could-not-be-initialized%2F&amp;linkname=SQL%20Server%3A%20Error%20Msg%205009-One%20or%20more%20files%20listed%20in%20the%20statement%20could%20not%20be%20found%20or%20could%20not%20be%20initialized" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-server-error-msg-5009-one-or-more-files-listed-in-the-statement-could-not-be-found-or-could-not-be-initialized%2F&amp;linkname=SQL%20Server%3A%20Error%20Msg%205009-One%20or%20more%20files%20listed%20in%20the%20statement%20could%20not%20be%20found%20or%20could%20not%20be%20initialized" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fsql-server-error-msg-5009-one-or-more-files-listed-in-the-statement-could-not-be-found-or-could-not-be-initialized%2F&#038;title=SQL%20Server%3A%20Error%20Msg%205009-One%20or%20more%20files%20listed%20in%20the%20statement%20could%20not%20be%20found%20or%20could%20not%20be%20initialized" data-a2a-url="https://www.dbrnd.com/2016/11/sql-server-error-msg-5009-one-or-more-files-listed-in-the-statement-could-not-be-found-or-could-not-be-initialized/" data-a2a-title="SQL Server: Error Msg 5009-One or more files listed in the statement could not be found or could not be initialized"></a></p><p>In this post, I am going to share one of the solution for SQL Server error like, One or more files listed in the statement could not be found or could not be initialized.</p>
<blockquote><p>Today morning, I was doing backup and restore exercise for one my report database. Generally, this database has one attached .mdf and .ldf file.<br />
I checked the database file properties and found one orphaned .ldf file also attached to this database. Physically was showing me only two files, but database file properties were showing me three files.</p></blockquote>
<p>When I tried to remove this orphaned file, I got this error:<br />
Msg 5009 One or more files listed in the statement could not be found or could not be initialized.</p>
<p><strong>Below are two different approaches to solve this problem:</strong></p>
<p><strong>Option 1: First, Try this quick way:</strong></p>
<blockquote><p>Take a LOG backup and your orphaned file entry will gone from the database.</p></blockquote>
<p><strong>Option 2: Second, follow the below steps:  </strong></p>
<p><strong>Add another filegroup:</strong></p>
<pre class="crayon-plain-tag">ALTER DATABASE [Employee] ADD FILEGROUP TempFG;</pre> </p>
<p><strong>Add another file in this new filegroup and with a different logical name, but in the same path:</strong></p>
<pre class="crayon-plain-tag">ALTER DATABASE [Employee] ADD FILE ( NAME = N'remove_templog', FILENAME = N'C:\DBBackup\Temo_log.ndf', SIZE = 1MB, MAXSIZE = 1MB) to FILEGROUP TempFG</pre> </p>
<p><strong>Now check this table sys.sysaltfiles, file id reused by newly created file.</strong></p>
<pre class="crayon-plain-tag">SELECT *FROM sys.sysaltfiles;</pre> </p>
<p><strong>Now removed the newly created file:</strong></p>
<pre class="crayon-plain-tag">ALTER DATABASE [Employee] REMOVE FILE remove_templog;</pre> </p>
<p><strong>Now try to drop your orphaned file:</strong></p>
<pre class="crayon-plain-tag">ALTER DATABASE [Employee] REMOVE FILE emp_log1;</pre> </p>
<p><strong>Drop newly created dummy file group:</strong></p>
<pre class="crayon-plain-tag">ALTER DATABASE [Employee] REMOVE FILEGROUP TempFG;</pre> </p>
<p><strong>Last, Take a full LOG backup and check your database file properties, the orphaned file should be removed now. </strong> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/11/sql-server-error-msg-5009-one-or-more-files-listed-in-the-statement-could-not-be-found-or-could-not-be-initialized/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
