SQL Server: Warning: Fatal error 823 occurred at date / time Note the error and time, and contact your system administrator.
We were contacted the other day by a client with issues selecting data from one of their tables after a recent server crash (not running on our servers or a site that we were involved in developing). The issue was easy enough to recreate as you just needed to select records after the server crash and you'd get the error:
Warning: Fatal error 823 occurred at date / time Note the error and time, and contact your system administrator.
A quick Google suggests a physical disk drive error and having a quick look at the issues it wasn't pretty. Running:
DBCC CHECKDB('DatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS
Resulted in:
Msg 8909, Level 16, State 1, Line 5 Table error: Object ID 0, index ID 12341, page ID (1:5880). The PageId in the page header = (9728:16777220). CHECKTABLE found 0 allocation errors and 1 consistency errors not associated with any single object. .... DBCC results for 'TableName'. Msg 8928, Level 16, State 1, Line 5 Object ID 871674153, index ID 0: Page (1:5880) could not be processed. See other errors for details. .... There are 20993 rows in 584 pages for object 'TableName'. CHECKTABLE found 0 allocation errors and 8 consistency errors in table 'TableName' (object ID 871674153). Msg 8909, Level 16, State 1, Line 5 Table error: Object ID 1109413712, index ID 24940, page ID (1:5883). The PageId in the page header = (25198:1632843825). CHECKTABLE found 0 allocation errors and 1 consistency errors in table '(Object ID 1109413712)' (object ID 1109413712).
Most of the solutions found on Google resulted in some form of system restore but that's no good in this instance as the backups only existed for after the problem was identified (great eh!) so were useless.
Although it's not an ideal solution, you can use DBCC CHECKTABLE which in our case fixed the issue:
--Put the database into single user mode ALTER DATABASE [DatabaseName] SET SINGLE_USER WITH NO_WAIT --Check the erors and fix any issues found (that you can) DBCC CHECKTABLE ('Orders', REPAIR_REBUILD) --Put the database back into multiuser mode ALTER DATABASE [DatabaseName] SET MULTI_USER WITH NO_WAIT
I'd be interested to know other solutions people may have to this issue.
Note to readers: Check that your hosting provider performs regular backups and checks the health of your server regularly to avoid this happening to you.
Liked this post? Got a suggestion? Leave a comment