2024年5月8日发(作者:)

Sql数据库质疑处理方法

1. 首先停止sql服务、将质疑的数据库文件复制到其他盘进行备份、备份完之后将质疑数

据库删除掉 然后启动sql服务重新安装建立一个新的数据库。

2. 停止sql服务 然后用备份出来的数据库后缀名为 MDF的文件替换新的MDF文件。且

删除掉后缀名为LDF的文件

3. 启动sql服务

4. 执行下列语句:

Use Master

go

sp_configure 'allow updates', 1

reconfigure with override

go

begin tran

update sysdatabases set status = 32768 where name = '数据库名'

--Verify one row is updated before committing

commit tran

go

5. 停止sql再重新启动sql服务,然后运行下列语句:

use master

go

DBCC TRACEON(3604)

DBCC REBUILD_LOG

('数据库名称',

'D:Program FilesMicrosoft SQL ServerMSSQLData数据库名称_')--(注:在这里输入

自己的数据库路径)

Go

6. 停止sql然后重新启动sql服务,然后运行下列语句:

use master

go

update sysdatabases set status = 8 where name = '数据库名称'

go

sp_configure 'allow updates', 0

reconfigure with override

go

7. 运行dbcc checkdb(db_name) 检查修复好的质疑数据库是否正常