【生产问题】-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 ...
随机推荐
- Django的模型
Django的模型类相当于数据库的一张表,模型类的实例对象相当于表中的一行内容 Django提供了多种创建对象的方式,常用如下: 通过create()方法 1.Person.objects.creat ...
- UI-9-UITableView
课程要点: UITableView及其两种风格和三部分 UITableViewController UITableViewCell及其四种风格 通过代理给UITableView设置cell 性能优化 ...
- TPM Key相关概念
1. Storage Keys:存储密钥,用来加密数据和其它密钥的通用非对称密钥,这里的其它密钥可以是另外一个存储密钥,也可以是绑定密钥或签名密钥.它本身是长度2048bit的RSA私钥:它既可以是可 ...
- libsvm easy.py ValueError: need more than 0 values to unpack windows下终极解决
现象是: python easy.py train test 输出: Scaling training data...WARNING: original #nonzeros 100389 new #n ...
- Android处理图片工具(转载)
内容来源于http://www.cnblogs.com/TerryBlog/archive/2012/01/08/2316482.html package com.wireme.activity; i ...
- Laravel 的中大型专案架构
好文:http://oomusou.io/laravel/laravel-architecture/
- diango-tinymce富文本编译器
应用到项目中 在settings.py中为INSTALLED_APPS添加编辑器应用 INSTALLED_APPS = ( ... 'tinymce', ) 在settings.py中添加编辑配置项 ...
- JAVA学习第六十三课 — 关于client服务端 && URL类 & URLConnection
常见的client和服务端 client: 浏览器:IE:弹窗体,猎豹:弹窗体.多标签,争强效果 服务端: server:TomCat:1.处理请求 2.给予应答 想让TomC ...
- 深入理解line
什么是行间距? 古时候我们使用印刷机来出来文字.印刷出来的每个字,都位于独立的一个块中. 行间距,即传说中控制两行文字垂直距离的东东.在CSS中,line-height被用来控制行与行之间垂直距离. ...
- Java之美[从菜鸟到高手演变]之字符串
一.String 1.String简介 初始化: 一般由String声明的字符串,长度是不可变的,这也是它与StringBuffer和StringBuilder最直观的一个区别.一般初始化方式:Str ...