Error Fix: Msg 605 Attempt to fetch logical page (3:1307866) in database 6 failed. It belongs to allocation unit 72057594113359872 not to 72057594113490944

Msg 605, Level 21, State 3, Line 1
Attempt to fetch logical page (3:1307866) in database 6failed. It belongs to allocation unit 72057594113359872 not to72057594113490944.
Or
Msg 21, Level 21, State 1, Line 1
Warning: Fatal error 605 occurred at OCT  31 2011 6:08AM. Note the error and time, and contact your system administrator.
This error comes in red color is disguise, if you login withany user which is not sysadmin type user, you will see this kind of error incorruption of page(s), if you login with SA, Administrator or and otherSysAdmin login, you will not see error comes in red color but the descriptiveerror given in the title
There was a festival holidays in our Indian office from 26thto 28th OCT 2011 (Wed/Friday) so obviously I was out of town andback after 5 days on 31st OCT 2011. As soon as I come to the officeand checked few of my email, I suddenly get complain that few pages in oursoftware are throwing an error so I picked up the query which was there inthose pages along with the same parameter they were providing and found theerror given above.
As soon as I read this error, I came to know that there is apage corruption in database.  It may bedue to heavy snow fall in NJ in October, they have got power failure there fromfew days and tried to keep the server up and running via power generator. Assoon as Power Generator’s fuel get finished, everything gets down and afterrefuel, they starts everything again. I came to know this as soon as I comeback from holiday. I think this is the Indian New Year gift to me.
I tried to gather some more information about the data fileand page number given in error message with DBCC PAGE command.
dbcc traceon(3604)
dbcc page(‘MyDatabaseName’,3,1307866,3)

dbcc traceoff(3604)

You can use option 0,1,2,3 as the last parameter (bold 3) ofDBCC PAGE command.
So now I have two options.
1.)    Restorethat page from full Database backup
2.)    TryDBCC commands and if needed, allow data loss
I HIGHLY RECOMMEND to go for 1st option but ifyou are out of luck and don’t have last full backup, you must have to go forsecond way.
I have restored page from my last full database backup withbelow given TSQL.
RESTORE DATABASE MyDatabaseName
PAGE = ‘3:1307866’
FROM DISK = ‘D:\MyDatabaseName.bak’
WITH NORECOVERY
Now, let us talk about second option if you don’t have fullbackup of your database. Use DBCC CHECKDB command.
–checkingdatabase’s integrity and won’t show so many informational message,
–it will onlyshows error messages and warnings.
DBCC CHECKDB(‘MyDatabaseName’) WITH NO_INFOMSGS
Once you execute above command, it will recommend you repairlevel. it may recommend REPAIR_REBUILD if you really lucky but if you will seerepair level REPAIR_ALLOW_DATA_LOSS, you have to be ready to lose some of yourdata.
You may use either of the below given command based on theRepair Level you have been suggested.
1.)
ALTER DATABASE MyDatabaseName SETSINGLE_USER
GO
DBCC CHECKDB(‘MyDatabaseName’, REPAIR_REBUILD)
GO
ALTER database MyDatabaseName SETMULTI_USER
GO
2.)
ALTER DATABASE MyDatabaseName SETSINGLE_USER
GO
DBCC CHECKDB(‘MyDatabaseName’, REPAIR_ALLOW_DATA_LOSS)
GO
ALTER database MyDatabaseName SETMULTI_USER
GO
Moral of the story is, always have FULL recovery model foryour database and schedule full/ transaction/ differential backup policy. Thisis a MUST DO for any DBAs. You never know, when will you need it!!!!
Reference: Ritesh Shah
 
http://www.sqlhub.com
Note: Microsoft Books online is a default reference of all articles but examplesand explanations prepared by Ritesh Shah, founder of
http://www.SQLHub.com
Ask me any SQL Serverrelated question at my “ASK Profile
Advertisements