June 8, 2008 at 2:05 am
Dear All,
i administrate an sql-db since a few weeks and now i see that there were errors in the db.
DBCC CHECKTABLE ('KHKVKBelege');
Server: Nachr.-Nr. 8928, Schweregrad 16, Status 1, Zeile 1
Objekt-ID 1814297523, Index-ID 0: Seite (1:153062) konnte nicht verarbeitet werden. Einzelheiten finden Sie in anderen Fehlermeldungen.
Server: Nachr.-Nr. 8939, Schweregrad 16, Status 1, Zeile 1
Tabellenfehler: Objekt-ID 1814297523, Index-ID 0, Seite (1:153062). Test (m_freeCnt == freeCnt) fehlgeschlagen. Werte sind 535 und 567.
Server: Nachr.-Nr. 8964, Schweregrad 16, Status 1, Zeile 1
Tabellenfehler: Objekt-ID 1814297523. Auf den text-, ntext- oder image-Knoten auf Seite (1:153065), Slot 28, Text-ID 282892435456 wird nicht verwiesen.
Server: Nachr.-Nr. 8961, Schweregrad 16, Status 1, Zeile 1
Tabellenfehler: Objekt-ID 1814297523. Der text-, ntext- oder image-Knoten auf Seite (1:185015), Slot 41, Text-ID 310381641728 stimmt nicht mit seinem Verweis von Seite (1:185016), Slot 6 überein.
Es sind 427855 Zeilen in 48642 Seiten für das KHKVKBelege-Objekt vorhanden.
CHECKTABLE hat 0 Reservierungsfehler und 84 Konsistenzfehler in der KHKVKBelege-Tabelle gefunden (Objekt-ID 1814297523).
repair_allow_data_loss ist das Minimum für die REPAIR-Stufe für die von DBCC CHECKTABLE (KHKDB.dbo.KHKVKBelege ) gefundenen Fehler.
select *
from sysindexes
where indid = 0 and id = 1814297523:
id 1814297523
status 0
first
indid 0
root
minlen 436
keycnt 0
groupid 1
dpages 48645
reserved 84275
used 84363
rowcnt 427883
rowmodctr 11567
reserved3 0
reserved4 0
xmaxlen 3527
maxirow 0
OrigFillFactor 0
StatVersion 0
reserved2 15303
FirstIAM
impid -1
lockflags 0
pgmodctr 0
keys
name KHKVKBelege
statblob
maxlen 8000
rows 427883
After DBCC CHECKTABLE ('KHKVKBelege', Repair_Allow_Data_loss) i see that there was 29 entrys killed:
Fehlerbehebung: Reservierung von Seite (1:153062) für Objekt-ID 1814297523, Index-ID 0 wurde aufgehoben.
Fehlerbehebung: Reservierung von Seite (1:158880) für Objekt-ID 1814297523, Index-ID 0 wurde aufgehoben.
Fehlerbehebung: Reservierung von Seite (1:180530) für Objekt-ID 1814297523, Index-ID 0 wurde aufgehoben.
Fehlerbehebung: Textspalte mit Text-ID 310379544576, für Objekt-ID 1814297523 auf Seite (1:185007), Slot 7 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 310379544576, für Objekt-ID 1814297523 auf Seite (1:185016), Slot 6 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547144196096, für Objekt-ID 1814297523 auf Seite (1:797529), Slot 1 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547115032576, für Objekt-ID 1814297523 auf Seite (1:798027), Slot 4 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547115098112, für Objekt-ID 1814297523 auf Seite (1:798027), Slot 4 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547124600832, für Objekt-ID 1814297523 auf Seite (1:798027), Slot 5 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547124666368, für Objekt-ID 1814297523 auf Seite (1:798027), Slot 5 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547124731904, für Objekt-ID 1814297523 auf Seite (1:798027), Slot 5 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547133120512, für Objekt-ID 1814297523 auf Seite (1:798027), Slot 6 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547133186048, für Objekt-ID 1814297523 auf Seite (1:798027), Slot 6 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547133251584, für Objekt-ID 1814297523 auf Seite (1:798027), Slot 6 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547137839104, für Objekt-ID 1814297523 auf Seite (1:798027), Slot 7 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547137904640, für Objekt-ID 1814297523 auf Seite (1:798027), Slot 7 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547137970176, für Objekt-ID 1814297523 auf Seite (1:798027), Slot 7 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547149635584, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 0 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547149701120, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 0 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547149766656, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 0 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547155009536, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 1 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547155075072, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 1 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547162939392, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 2 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547163004928, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 2 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547163070464, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 2 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547168903168, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 3 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547168968704, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 3 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547169034240, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 3 wurde gelöscht.
Fehlerbehebung: Textspalte mit Text-ID 2547175522304, für Objekt-ID 1814297523 auf Seite (1:798028), Slot 4 wurde gelöscht.
My questions:
How can i resolve the errors without killed data ?
How can i see the row with the text-id xyz ?
Please don't tell me to use a backup 😉
Bye,
Stephan
June 8, 2008 at 2:45 am
Sorry, my german is not that good (and I'm lazy to seach for the English translation 😛 )
First: If you have a database with DBCC reported problems, make a backup :doze: before executing dbcc with options like allow dataloss
You won't know what is to be deleted by SQL until the job finishes.
Second: If the corruption is in a nonclustered index, you're lucky: just drop an recreate the index. If it's in a table or clustered index try exporting the data with BCP before doing any maintenance.
Wilfred
The best things in life are the simple things
June 8, 2008 at 7:27 am
Well here's the thing - if CHECKDB says that you need to use REPAIR_ALLOW_DATA_LOSS, then it's going to lose data because the way it repairs things is to delete the corrupt values. I engineered it that way because that's the fastest and most provably correct way of repairing corruptions.
The only way to avoid data loss in a situation like this is to have a backup.
Thanks
Paul Randal
CEO, SQLskills.com: Check out SQLskills online training!
Blog:www.SQLskills.com/blogs/paul Twitter: @PaulRandal
SQL MVP, Microsoft RD, Contributing Editor of TechNet Magazine
Author of DBCC CHECKDB/repair (and other Storage Engine) code of SQL Server 2005
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply