免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2592 | 回复: 1
打印 上一主题 下一主题

数据表读取报错,用dbcc检查后的错误,请高手赐教 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-04-10 09:11 |只看该作者 |倒序浏览
Checking TRACE: Logical pagesize is 2048 bytes
The total number of data pages in this table is 3293.
Msg 2583, Level 18, State 1:
Line 1:
Number of data pages (3293) counted by DBCC differs from count in the data OAM
(3291) for dbid 4 object 395148453.
Table has 75866 data rows.
Checking CATALOG: Logical pagesize is 2048 bytes
Msg 7127, Level 16, State 4:
Line 1:
Text pointer value references a data page with an invalid time stamp.
Msg 7901, Level 16, State 1:
Line 1:
Page 30438933 was expected to be the first page of a TEXT/IMAGE value.
Msg 7127, Level 16, State 4:
Line 1:
Text pointer value references a data page with an invalid time stamp.
Msg 605, Level 16, State 1:
Line 1:
An attempt was made to fetch logical page '30438920' in database 'courtdb' from
cache 'default data cache'. Page belongs to object with id '1550625536', not to
object 'CATALOG'.
Checking FEE: Logical pagesize is 2048 bytes
Msg 605, Level 16, State 1:
Line 1:
An attempt was made to fetch logical page '1905154' in database 'courtdb' from
cache 'default data cache'. Page belongs to object with id '1038626743', not to
object 'FEE'.

论坛徽章:
0
2 [报告]
发表于 2007-04-10 14:10 |只看该作者
Error ID =605 (转载)
An attempt was made to fetch logical page '%ld' in
database '%.*s' from cache '%.*s'. Page belongs to
object with id '%ld', not to object '%.*s'.

-------------------------------------------------------------------------------------------------
使用dbcc tablealloc 去检查出现错误的表

命令格式:
dbcc tablealloc('错误信息中第二个表对象')

最好将错误结果使用 isql 的 -o 参数输出到文件中便于察看


注意:
    这个dbcc 操作可能会锁住接受检查的表,这将影响到其他进程的访问和操作。
-------------------------------------------------------------------------------------------------

DBCC 结果(例子为正常结果):

The default report option of OPTIMIZED is used for this run.  
The default fix option of NOFIX is used for this run.  
***************************************************************  
TABLE: Tablename OBJID = id_number  
INDID=1  FIRST=257  ROOT=264  SORT=0  
Data level: 1.  1 Data pages allocated and 1 Extents allocated.  
Indid   : 1.  1 Index pages allocated and 1 Extents allocated.  
INDID=2  FIRST=272  ROOT=272  SORT=0  
Indid   : 2.  1 Index pages allocated and 1 Extents allocated.  
TOTAL # of extents = 3  
Alloc page 256 (# of extent=1 used pages=2 ref pages=2)  
Alloc page 256 (# of extent=1 used pages=3 ref pages=3)  
Alloc page 256 (# of extent=1 used pages=2 ref pages=2)  
Total (# of extent=3 used pages=7 ref pages=7) in this database  
DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role.  

-------------------------------------------------------------------------------------------------
一.  
如果有一些错误(例如2583或者其他)出现在 INDID为0之后,表示表本身数据损坏。
解决办法:
1. 使用 "select into" 或者 "insert into ... select " 将坏表中能够正常访问的数据取出装入一个临时表中。同时可以使用
" where"加上一些可以缩小选择范围的条件尽量多的将正常的数据取出
2. 或者使用bcp去导出正常的数据
3. 对于实在无法取出的数据,只能通过应用系统中的冗余或者相关信息进行恢复
4. 删除或者重命名坏表,并重新创建新表
5. 将导出的正常数据重新导入新表中

注意: 可能会有一些数据的丢失
-------------------------------------------------------------------------------------------------
二.
如果有一些错误(例如2583或者其他)出现在 INDID为1之后,说明表上的聚簇索引损坏,解决方法同一,也可能出现数据丢失。
如果有一些错误(例如2583或者其他)出现在 INDID为2,3,4.....之后,说明为表上的非聚簇索引损坏,解决方法比较简单,删除此索引然后重新创建即可。

步骤如下:
1. use databasename
   go

2. 获知索引名称
   select name from sysindexes where id = table_object_id and indid = index_number
   go
   
3. 创建一个跟坏索引不同名称但具有相同列的索引
   create index
   你可以使用 sp_help table_name 去察看索引上的列信息
4. 将已损坏索引删除
   drop index

-------------------------------------------------------------------------------------------------
当这些故障排除完毕后,有时间及业务系统允许的情况下,最好再做一次全库的dbcc检查

DBCC checkdb(db_name)
DBCC checkalloc(db_name)
DBCC checkcatalog(db_name)
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP