前幾天,數據庫文件出問題,現象就是,一些的查詢操作會報以下錯誤:
Microsoft OLE DB Provider for SQL Server 錯誤 '80004005'
Warning: Fatal error 644 occurred at Aug 5 2004 8:45AM
或者:
Microsoft OLE DB Provider for SQL Server 錯誤 '80004005'
Warning: Fatal error 823 occurred at Aug 4 2004 10:39PM
823 錯誤是指:
SQL Server 在對某設備進行讀或寫請求時遇到 I/O 錯誤。該錯誤通常表明磁盤
問題。
644 錯誤是指:
當索引 ID 表示的非聚集索引出錯時發生該錯誤。當進程試圖刪除不存在的行時檢測到該損壞。
那個數據庫服務器的硬盤是做了Raid 5 的,查詢具體的硬盤,沒有看到那塊硬盤壞了。把數據備份,然后恢復到另外一臺機子。仍然存在這個問題。顯然數據庫文件有壞塊了。
試圖通過下面語句修復數據庫,但是只能修復部分數據,但是不能完全修復。
dbcc checktable('數據表')
dbcc checktable('數據表') WITH ALL_ERRORMSGS
DBCC CHECKTABLE (數據表,repair_allow_data_loss)
DBCC DBREINDEX('數據表')
sp_dboption '數據庫名', 'SINGLE USER', TRUE
DBCC CHECKDB('數據庫名', REPAIR_ALLOW_DATA_LOSS)
sp_dboption '數據庫名', 'SINGLE USER', FALSE
用SQL Server 的導入導出功能無法完全導出數據。會報 823 錯誤。對所有數據的Select ,也會報 823 錯誤。
下面是用這些修復語句修復后,返回的一些有代表性的錯誤信息:
Server: Msg 8929, Level 16, State 1, Line 1
對象 ID 797245895: 在文本 ID 4582550994944 中發現錯誤,該文本的所有者是由 RID = (1:65204:25) ReplyID = 22853478 標識的數據記錄。
Server: Msg 8909, Level 16, State 1, Line 1
表錯誤: 對象 ID 0,索引 ID 13824,頁 ID (1:430153)。頁首結構中的 PageId = (31744:9744137)。
Server: Msg 2533, Level 16, State 1, Line 1
表錯誤: 未發現頁 (1:307388),該頁分配給了對象 ID 397244470,索引 ID 0。可能頁無效或頁首結構中的對象 ID 信息不正確。
Server: Msg 8978, Level 16, State 1, Line 1
表錯誤: 對象 ID 397244470,索引 ID 1。頁 (1:307360) 缺少上一頁 (1:307391) 對它的引用。可能是因為鏈的鏈接有問題。
Server: Msg 8976, Level 16, State 1, Line 1
表錯誤: 對象 ID 397244470,索引 ID 1。在掃描操作中未發現頁 (1:307388),而其父代 (1:308098) 和上一頁 (1:307387) 指向了該頁。請檢查先前的錯誤。
Server: Msg 8980, Level 16, State 1, Line 1
表錯誤: 對象 ID 397244470,索引 ID 1。索引節點頁 (1:308098),槽 155 指向子頁 (1:307389) 和上一子頁 (1:307388),但未遇到這些頁。
Server: Msg 8939, Level 16, State 1, Line 1
表錯誤: 對象 ID 825360384,索引 ID 62467,頁 (1:430152)。測試(m_slotCnt < MaxSlot)失敗。值為 5409 和 4048。
Server: Msg 8986, Level 16, State 1, Line 1
發現的錯誤數目(201)太多(屬于對象 ID 797245895)。若要查看所有的錯誤信息,請用 'WITH ALL_ERRORMSGS' 重新運行該語句。
Server: Msg 8964, Level 16, State 1, Line 1
Table error: Object ID 797245895. The text, ntext, or image node at page (1:90548), slot 53, text ID 4297096364032 is not referenced.
Server: Msg 8974, Level 16, State 1, Line 1
Text node referenced by more than one node. Object ID 797245895, text, ntext, or image node page (1:100941), slot 15, text ID 4367996551168 is pointed to by page (1:407572), slot 25 and by page (1:430169), slot 25.
Server: Msg 8961, Level 16, State 1, Line 1
Table error: Object ID 797245895. The text, ntext, or image node at page (1:100944), slot 29, text ID 4582550732800 does not match its reference from page (1:430166), slot 55.
Server: Msg 8965, Level 16, State 1, Line 1
Table error: Object ID 797245895. The text, ntext, or image node at page (1:307381), slot 4, text ID 4584554954752 is referenced by page (1:3786), slot 75, but was not seen in the scan.
Error: 823, Severity: 24, State: 2
I/O error (torn page) detected during read at offset 0x000000d2086000 in file 'E:\database\DbName.mdf'.
?
?
17310 :
SqlDumpExceptionHandler: Process 3224 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
?
17065 :
SQL Server Assertion: File: <"xact">, line = 838 Failed Assertion = '!m_parNestedXactCnt' Trying to use the transaction while there are 5 parallel nested xacts outstanding.
?
18052 :
Error: 3624, Severity: 20, State: 1.
?
17066 :
SQL Server Assertion: File: <proc.c>, line=1576 Failed Assertion = 'm_activeSdesList.Head () == NULL'.
?
17066 :
SQL Server Assertion: File: <recbase.cpp>, line=1378 Failed Assertion = 'm_offBeginVar < m_SizeRec'.
?
這些修復都無效后,最后只有采用了最原始的方式,寫程序逐行用SELECT語句將數據提取出來。好在每天都有備份,這次只有幾十條數據丟失。
至于為啥產生這個錯誤,目前仍然不知道。
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=69303
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
