DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 2015747 - Last Review: May 7, 2014 - Revision: 3.0

Symptoms

A query or operation may fail with an error like the following when an invalid file ID is referenced by the SQL Server Engine:

Msg 5180, Level 22, State 1, Line 1
Could not open File Control Bank (FCB) for invalid file ID 255 in database 'mydb'. Verify the file location. Execute DBCC CHECKDB.

Since this error is severity 22, the user's session will be disconnected. This error message is written into the SQL Server ERRORLOG and the Windows Application Event Log with EventID = 5180.

Cause

The SQL Server Engine references a file ID in many different situations mostly when referencing a page id (since the file ID is the first portion of the page ID). If for any reason, the file ID being referenced is < 0 or is not a valid file ID in a database (per the valid file IDs listed in system catalog views such as sys.database_files), then a 5180 error can be encountered.

One possible cause is that a stored file ID is not valid. An example of this is a forwarded record. Since the forwarded record in a row references another page, when that page is accessed and the file ID is invalid, a 5180 error could be encountered. This condition would be a database corruption error on the page with the forwarded record. (In this example, DBCC CHECKDB would report Msg 8993).

Another example is an invalid file ID as part of a page ID as stored in the page header for a "next" or "prev" page ID. This field is used to link a series of pages such as in a clustered index. If the file ID is invalid for the prev or next page, when the engine must reference this to traverse to the next or previous page, a 5180 error can be encountered. (In this example, DBCC CHECKDB reports Msg 8981).

If the problem is not an invalid file ID due to a corrupted stored page ID, then the problem may be within the SQL Server Engine.

Resolution

If you encounter this error, you should run DBCC CHECKDB against the database as listed in the error message. If you find errors, you should restore from a known good backup. If you cannot restore from a backup, then your other option is to use the repair option of DBCC CHECKDB as recommended by its output. In most cases, a repair of this type of error will result in a data loss. For more information about using CHECKDB and causes of database corruption problems see the article: How to troubleshoot database consistency errors reported by DBCC CHECKDB

If DBCC CHECKDB does not report any error and the problem continues to occur, you should contact Microsoft Technical Support for assistance. Be prepared to provide the query that is encountering the 5180 error. See the More Information section on how to determine what query encountered the error.

More Information

The File Control Block (FCB) is an internal memory structure that keeps track of important information about the file associated with the database. A file ID is used to uniquely identify a FCB for a database. If the server engine tries to reference a file ID that is invalid, the FCB structure cannot be located which triggers the 5180 error condition.

To find out what query encountered this error, you can use the following techniques:

  • For SQL Server 2008 and later versions, see if the system_health session has a record of the error which should include the query text. See the following resource for more information about the system_health session: http://blogs.msdn.com/psssql/archive/2008/07/15/supporting-sql-server-2008-the-system-health-session.aspx
  • Use SQL Server Profiler and capture the SQL:BatchStarting, RPC:Starting, and Exception Events. Find the query that precedes the Exception Event for 5180 for the session associated with the Exception Event.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use (http://go.microsoft.com/fwlink/?LinkId=151500) for other considerations.

Applies to
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft SQL Server 2005 Express Edition
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Workgroup Edition
  • Microsoft SQL Server 2008 Developer
  • Microsoft SQL Server 2008 Enterprise
  • Microsoft SQL Server 2008 Express
  • Microsoft SQL Server 2008 Express with Advanced Services
  • Microsoft SQL Server 2008 R2 Developer
  • Microsoft SQL Server 2008 R2 Enterprise
  • Microsoft SQL Server 2008 R2 Standard
  • Microsoft SQL Server 2008 R2 Web
  • Microsoft SQL Server 2008 R2 Workgroup
  • Microsoft SQL Server 2012 Developer
  • Microsoft SQL Server 2012 Enterprise
  • Microsoft SQL Server 2012 Express
  • Microsoft SQL Server 2012 Standard
  • Microsoft SQL Server 2012 Web
  • Microsoft SQL Server 2014 Developer
  • Microsoft SQL Server 2014 Enterprise
  • Microsoft SQL Server 2014 Express
  • Microsoft SQL Server 2014 Standard
  • Microsoft SQL Server 2014 Web
Keywords: 
KB2015747
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support