Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am getting 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

StackTrace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.DoLoadDataSet(IDbCommand command, DataSet dataSet, String[] tableNames)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.LoadDataSet(DbCommand command, DataSet dataSet, String[] tableNames)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.LoadDataSet(DbCommand command, DataSet dataSet, String tableName)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteDataSet(DbCommand command) in D:\SVN_Workspace\Login.cs:line 1205

What does this exception mean and any resolution to above issue?

share|improve this question
1  
Smells like there's data corruption in your database..... –  marc_s Oct 23 '12 at 7:07
    
can you show us your procedure? –  karthi Oct 23 '12 at 7:20
add comment

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

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

3 Answers

up vote 5 down vote accepted

You may not need to restore from backup just yet. As a sysadmin, execute DBCC PAGE (2, 5, 65424, 3). 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 rebuild the index. Run that command, and let me know what you find.

Hope this helps,

Matt

share|improve this answer
3  
index id 0 is heap, 1 is clustered. NC indexes are > 1. While true that rebuilding NC index is OK, a corruption seldom comes alone... –  Remus Rusanu Oct 23 '12 at 14:15
    
@RemusRusanu Thanks for the correction. I answered too early in the morning. Edited to reflect reality. +1 For corruption seldom comes alone. –  Matt M Oct 23 '12 at 14:21
2  
hmmm... database 2 is tempdb, maybe there really is no back for it ;) –  Remus Rusanu Oct 23 '12 at 14:46
    
@RemusRusanu In that case, the service could be restarted, and tempdb recreated. If there is hardware failure, however, this could potentially manifest itself later in a user database. –  Matt M Oct 23 '12 at 17:57
add comment

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.

share|improve this answer
add comment

Your database is corrupt. The good news is that this is the tempdb database (database ID 2) so fixing this is easy, just restart the database instance.

Now you have a bigger problem, figuring out why it 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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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