【生产问题】-dbcc checkdb报错-数据页故障
更多操作参考:https://www.cnblogs.com/gered/p/9435282.html
【生产问题】-dbcc checkdb报错-数据页故障
数据页故障,索引页故障
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) --尝试无损修复
--结果如下
DBCC results for 'Sys_Users_Goods'.
Msg 8978, Level 16, State 1, Line 1
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.
Repairing this error requires other errors to be corrected first.
Msg 8978, Level 16, State 1, Line 1
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.
Repairing this error requires other errors to be corrected first.
Msg 8928, Level 16, State 1, Line 1
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.
The repair level on the DBCC statement caused this repair to be bypassed.
Msg 8939, Level 16, State 98, Line 1
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 213911561 and -4.
Repairing this error requires other errors to be corrected first.
Msg 8976, Level 16, State 1, Line 1
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.
Repairing this error requires other errors to be corrected first.
Msg 8928, Level 16, State 1, Line 1
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.
Repairing this error requires other errors to be corrected first.
Msg 8939, Level 16, State 98, Line 1
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 12584969 and -4.
Repairing this error requires other errors to be corrected first.
Msg 8976, Level 16, State 1, Line 1
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.
2.再次尝试,尝试运行丢失数据修复
select object_name(477960779) --根据object_id来找到故障对象
use db_tank
select count(1) from db_tank..Sys_Users_Goods where isexist=1 --61364953 --备份该库的有效数据,记录下该表的有效数据行
select count(1) from db_tank..Sys_Users_Goods --居然报错,那么肯定是isexist !=1的数据所在页有问题,那么即使丢失数据,也是isexist!=1的,也就是我不在乎的无效数据。那么直接跑
dbcc checktable('Sys_Users_Goods',repair_allow_data_loss)--尝试运行丢失数据修复
--出现 error has been repaired;
select count(1) from db_tank..Sys_Users_Goods where isexist=1 --61364953 --再次校验数据是否等于61364953,发现相等,证明只丢失了非有效数据
select count(1) from db_tank..Sys_Users_Goods --再次查看,是否完成修复,一查,不报错了,那么就证明错误已经修复。 --恢复数据库模式为多用户模式
alter database db_tank
set multi_user with rollback IMMEDIATE
DBCC CHECKDB 算是管理员们最常用的命令也是必须要知道的命令了。定期的检查及问题的修复都是比较重要的!!下面介绍一下 DBCC CHECKDB 的一些基本用法。
DBCC CHECKDB 完成两项任务:
- 检查数据库里有没有损坏发生。
- 尽力修复数据库损坏,使数据库能够被重新正常访问。
DBCC CHECK 做了些什么:
- 检查一些关键的系统表
- 对数据库运行DBCC CHECKALLOC
- 对数据库运行DBCC CHECKCATALOG
- 验证数据库中每个索引视图的内容
- 验证数据库中service broker数据
DBCC CHECKDB提供的修复方法
- Repair_allow_data_loss :尝试修复所有错误(可能导致一些数据丢失,一般无发从备份恢复才使用)
- Repair_fast 未执行任何修复
- Repair_rebuild :执行次要、快速修复(如:修复非聚集索引中的额外键)及耗时修复(如:重新生成索引),这些修复不会造成数据丢失。
注意:使用Repair_allow_data_loss参数导致的数据丢失也许是不能接受的,一般从备份还原的数据丢失可以做到心里有数,可以通过查询丢失前数据条数与修复后数据条数进行对比知道丢了多少数据。另外在早期备份中尝试找回。
如果使用repair_allow_data_loss级别都不能恢复:
- 按照预先备份恢复
- 如果损坏发生在默写用户对象(表、视图、存储过程等),可以把它们DROP掉
- 将数据库设置成紧急只读模式,用select into 将数据导入一个新建的空库。挽救尽可能多的数据,但是损坏严重程度不一样,丢失的数据多少也不一样。这样挽救回来的数据库各个数据表的状态将不一致,一般在逻辑上或有很大的问题。
虽然sqlserver 对dbcc checkdb 做了一些优化但是对于较大的数据库还是不小的负担所以分时间段进行不同的check检查以分散一次check的影响。还可以通过下面两个参数减轻一些消耗负担
- With noindex : 不对非聚集索引检查。
- With physical_only:只做物理结构完整性检查。
【生产问题】-dbcc checkdb报错-数据页故障的更多相关文章
- 生产环境elasticsearch5.0报错IllegalArgumentException: number of documents in the index cannot exceed 2147483519的处理
最近几天的push:user:req数据写不到集群,报错如下: [--13T09::,][DEBUG][o.e.a.b.TransportShardBulkAction] [yunva_etl_es8 ...
- SAP SOAMANAGER报错原因与故障排除方法
一些刚刚接触到SAP Webservice的开发者由于对SAP Netweaver组件的不熟悉,往往在使用事物码SOAMANAGER进行webservice配置的时候,发现无法正常启动SOAMANAG ...
- quartz 报错:java.lang.classNotFoundException
最近在做一个调度平台改造的项目,quartz在测试环境跑的是单机环境,生产上两台服务器做集群. 测试环境是ok的,生产上线后报错,一个类java.lang.classNotFoundException ...
- MS Sql Server 数据库或表修复(DBCC CHECKDB)
MS Sql Server 提供了很多数据库修复的命令,当数据库质疑或是有的无法完成读取时可以尝试这些修复命令. 1. DBCC CHECKDB 重启服务器后,在没有进行任何操作的情况下,在SQL ...
- SQL Server 存储(1/8):理解数据页结构
我们都很清楚SQL Server用8KB 的页来存储数据,并且在SQL Server里磁盘 I/O 操作在页级执行.也就是说,SQL Server 读取或写入所有数据页.页有不同的类型,像数据页,GA ...
- SQL Server :理解数据页结构
原文:SQL Server :理解数据页结构 我们都很清楚SQL Server用8KB 的页来存储数据,并且在SQL Server里磁盘 I/O 操作在页级执行.也就是说,SQL Server 读取或 ...
- 解决MySQL报错ERROR 2002 (HY000)【转】
今天在为新的业务线搭架数据库后,在启动的时候报错 root@qsbilldatahis-db01:/usr/local/mysql/bin# ./mysql ERROR 2002 (HY000): C ...
- DG duplicate报错:RMAN-05001:auxiliary file name /u01/app/oracle/oradata/fratbs01.dbf conflicts with a file used by the target database
问题:rman duplicate时报错: RMAN-05001:auxiliary file name /u01/app/oracle/oradata/fratbs01.dbf conflicts ...
- 解决MySQL报错ERROR 2002 (HY000)
今天在为新的业务线搭架数据库后,在启动的时候报错 root@qsbilldatahis-db01:/usr/local/mysql/bin# ./mysql ERROR 2002 (HY000): C ...
随机推荐
- 在iis6里使用没有扩展名的mvc
这2天mvc第二个预览终于出来了.赶紧拿过来测试.在装了3.5的虚拟主机上运行正常.应该已经可以到能正常使用的阶段了.不过我前面一篇翻译的文章中说到,如果使用的是iis6的话就只能忍气吞声的使用带扩展 ...
- c++ how to make your own class a valid key type for std::map?
In Java, if you want your own class to be a valid key type of the container, you just need to make i ...
- AFNet3.0上传图片
很多iOS应用都会遇到需要上传图片的情况,比如修改个人资料时需要上传自己的头像,最近我也遇到了这种情况,首先参考之前写过的AFNetWorking3.0处理请求头和请求内容. 我们在上述博客的基础之上 ...
- Introdution to Spring Mobile
1. In Eclipse, create a new Maven Project using the spring-mvc-jpa-archetype. 2. Add the spring-mobi ...
- Python运行机制(转)
From:https://blog.csdn.net/jeff_liu_sky_/article/details/52097060 https://stackoverflow.com/question ...
- ROS导航之地图costmap_2d与bresenham算法
读者可以参读http://wiki.ros.org/costmap_2d costmap_2d: 无论是激光雷达还是如kinect 或xtion pro深度相机作为传感器跑出的2D或3D SLAM ...
- matlab中双站异面直线法定位目标
calc.m %% 参数信息初始化 [x1,y1,z1]=deal(); [x2,y2,z2]=deal(,,); m1=/; n1=/; p1=^(/)/; m2=; n2=-^(/)/; p2=^ ...
- 转:SSD详解
原文:http://blog.csdn.net/a8039974/article/details/77592395, http://blog.csdn.net/jesse_mx/article/det ...
- go反射----3方法
声明:文章内容取自雨痕老师<Go语言学习笔记> 动态调用方法,谈不上有多麻烦.只需按IN列表准备好所需参数即可. package main import ( "fmt" ...
- redis 集群出现的错误
1 解决方法: 不用 Jedis jed =new jedis("192.168.56.101"); jed.set(key,value); 用 Set<HostAndPor ...