【问】修复数据库错误,如何解决? | ||
【适用版本】商云8 | 【模块】基本档案 | 【点击数】253 |
【知识编号】P2017081700012 | ||
【问题描述】使用siss提供的数据库修复语句还时出现一下错误 |
DBCC CHECKTABLE(t_im_flow, REPAIR_REBUILD )
DBCC CHECKTABLE(t_im_flow, repair_allow_data_loss )
也可先备份数据库执行以下语句修复索引和自增列,修复索引和自增列语句可以与数据库修复语句交替执行,若仍不能正常修复说明数据库损坏比较严重,建议建议联系专业数据库修复公司修复,或还原之前备份使用,或将基础数据导出后建新库使用,请确认,谢谢支持!
–修复自增列语句:
use hbposv8
go
declare @tablename varchar(100)
declare test_cur cursor for
select object_name(id) from syscolumns
where status=128
open test_cur
fetch test_cur into @tablename
while @@fetch_status=0
begin
DBCC CHECKIDENT (@tablename, RESEED)
fetch test_cur into @tablename
end
close test_cur
deallocate test_cur
go
—修复索引
use hbposv8
go
declare @tablename varchar(100)
declare test_cur cursor for
select object_name(id) from sysobjects
where type =’U’
open test_cur
fetch test_cur into @tablename
while @@fetch_status=0
begin
DBCC DBREINDEX(@tablename)
fetch test_cur into @tablename
end
close test_cur
deallocate test_cur
go