数据页故障,索引页故障
use db_tank dbcc checkdb
--报错如下
由index ID 3可以得知,其为非聚集索引页出了问题
Msg 8978, Level 16, State 1, Line 3 Table error: Object ID 477960779, index ID 3, partition ID 72057594074890240, alloc unit ID 72057594081509376 (type In-row data). Page (1:2335514) is missing a reference from previous page (1:3628311). Possible chain linkage problem. Msg 8978, Level 16, State 1, Line 3 Table error: Object ID 477960779, index ID 3, partition ID 72057594074890240, alloc unit ID 72057594081509376 (type In-row data). Page (1:2839352) is missing a reference from previous page (1:3598023). Possible chain linkage problem. Msg 8928, Level 16, State 1, Line 3 Object ID 477960779, index ID 3, partition ID 72057594074890240, alloc unit ID 72057594081509376 (type In-row data): Page (1:3598023) could not be processed. See other errors for details. Msg 8939, Level 16, State 98, Line 3 Table error: Object ID 477960779, index ID 3, partition ID 72057594074890240, alloc unit ID 72057594081509376 (type In-row data), page (1:3598023). Test (IS_OFF (BUF_IOERR, pBUF->bstat)) failed. Values are 46270473 and -4. Msg 8976, Level 16, State 1, Line 3 Table error: Object ID 477960779, index ID 3, partition ID 72057594074890240, alloc unit ID 72057594081509376 (type In-row data). Page (1:3598023) was not seen in the scan although its parent (1:7723523) and previous (1:7723545) refer to it. Check any previous errors. Msg 8928, Level 16, State 1, Line 3 Object ID 477960779, index ID 3, partition ID 72057594074890240, alloc unit ID 72057594081509376 (type In-row data): Page (1:3628311) could not be processed. See other errors for details. Msg 8939, Level 16, State 98, Line 3 Table error: Object ID 477960779, index ID 3, partition ID 72057594074890240, alloc unit ID 72057594081509376 (type In-row data), page (1:3628311). Test (IS_OFF (BUF_IOERR, pBUF->bstat)) failed. Values are 348260361 and -4. Msg 8976, Level 16, State 1, Line 3 Table error: Object ID 477960779, index ID 3, partition ID 72057594074890240, alloc unit ID 72057594081509376 (type In-row data). Page (1:3628311) was not seen in the scan although its parent (1:13500023) and previous (1:3075648) refer to it. Check any previous errors.
1、初步尝试
--切换单用户模式
alter database db_tank
set single_user with rollback IMMEDIATE
dbcc checkdb('db_tank',repair_rebuild) --尝试无损修复 select object_name(477960779) --根据object_id来找到故障对象 use db_tank select count(1) from db_tank..Sys_Users_Goods where isexist=1 --61364953 dbcc checktable('Sys_Users_Goods',repair_allow_data_loss)
--
alter database db_tank set multi_user with rollback IMMEDIATE
select * from db_tank_copy..sys_users_goods where itemid = 872981282 dbcc checktable('sys_users_goods',repair_allow_data_loss) -------------- USE master; GO DECLARE @SQL VARCHAR(3000); SET @SQL = ''; SELECT @SQL = @SQL+'; KILL ' + RTRIM(SPID) FROM [sys].[sysprocesses] AS sps WHERE [sps].[dbid] = DB_ID('db_tank'); SET @SQL = SUBSTRING(@SQL, 2, LEN(@SQL)); EXEC(@SQL); GO