9

I am getting the following SqlException on calling a stored procedure:

Attempt to fetch logical page (5:65424) in database 2 failed. It belongs to allocation unit 7349876362857938944 not to 4899918190390149120.

System.Data.SqlClient.SqlException occurred
Message="Attempt to fetch logical page (5:65424) in database 2 failed. It belongs to allocation unit 7349876362857938944 not to 4899918190390149120.

Source=".Net SqlClient Data Provider"
ErrorCode=-2146232060
Class=21
LineNumber=257
Number=605
Procedure="ispDisplayCount"
Server="10.10.1.1"
State=3

What does this exception mean? Is there any resolution to the above issue?

Although the database referenced in the error above indicates tempdb, similar errors referencing Message 605, may be fixed using the answers below.

Msg 605, Level 21, State 3, Line 1
Attempt to fetch logical page (1:8687634) in database 7 failed. It belongs to allocation unit 72057594364821504 not to 72057594052476928.

migrated from stackoverflow.com Oct 23 '12 at 11:46

This question came from our site for professional and enthusiast programmers.

10

If the database ID indicated by the error message is 2, the database affected is tempdb. One method for fixing this type of corruption in tempdb is to simply restart the SQL Server instance. For database ID's other than 2, follow the recommendations below.

You may need to restore from backup, however try this:

As a member of the sysadmin role, execute DBCC PAGE (2, 5, 65424, 3); and look for the Metadata: IndexId value.

  • If it is 0 (heap) or 1 (clustered index) you need to restore from backup.
  • If it is not 0 or 1, you can just rebuild the non-clustered index.

Run the DBCC command, and let us know what you find. Check https://www.mssqltips.com/sqlservertip/1578/using-dbcc-page-to-examine-sql-server-table-and-index-data/ for details about the DBCC PAGE command

8

Your database is corrupted. Time to restore from a good backup. If you have no backups, is time to learn about The Importance of Testing your Recovery Plan. An investigation into the reliability of your hardware is also warranted, watch for warning and errors in the system logs.

7

The error indicates your database is corrupt. The good news is that database ID 2 indicates this is the tempdb database, so fixing this is easy - just restart the database instance.

Once you restart the instance, you should figure out why the corruption happened. Start by running chkdsk on the drive that the problem file is on. Next you'll need to look at the storage itself and see if there's any problems there. Could be a physical disk issue, could be HBA or RAID card drivers, etc.

  • Denny, do you find doing RAM health checks would be beneficial as well? Have you seen a corrupt page in RAM also translate to corruption on disk? – Ali Razeghi Oct 25 '12 at 18:20
  • 1
    If there's a bad RAM stick that could cause a page to be reported as dirty. The odds are much higher that it's a problem with the disk subsystem than the memory. That would be the next place to look if the disks are in fact fine. – mrdenny Oct 26 '12 at 9:28
1

In my case, truncating and re-populating data in the concerned tables was the solution.

Most probably the data inside tables was corrupted.

1

I was able to resolve this by clearing the SQL caches:

DBCC FREEPROCCACHE
GO
DBCC DROPCLEANBUFFERS
GO

Apparently restarting the SQL service would have had the same affect.

(via Made By SQL, reproduced here to help others!)

1

What you would hear from a lot of people is "the database is corrupt, you need to restore" without even recommending that you take some few mins to do some of the following; review your logs, find out when the issue first occured, the error that preceeded that line, check out the database/table the page belongs to

In my case this error was preceeded by;

Unable to find index entry in index ID 9, of table 629577281, in database 'XYZ'. The indicated index is corrupt or there is a problem with the current update plan

A workaround was to trace the index referred to and temporarily delete it.

i later found a this Microsoft link that describes my exact issue and offers a solution link

hope this helps someone else in future

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.