1、这是网上搜索的办法,但是最后没能成功。
USE MASTER
GO
SP_CONFIGURE '
ALLOW UPDATES
',1
GO
RECONFIGURE WITH OVERRIDE
GO
UPDATE SYSDATABASES SET STATUS =32768 WHERE NAME='
置疑的数据库名
'
Go
sp_dboption '
置疑的数据库名
','
single
user
','
true
'
Go
DBCC CHECKDB('
置疑的数据库名
')
Go
update sysdatabases set status=28 where name='
置疑的数据库名
'
Go
sp_configure '
allow updates
',0
GO
reconfigure with override
Go
sp_dboption '
置疑的数据库名
', '
single
user
','
false
'
Go
2、先试着删除数据库,失败则kill进程,然后再执行恢复
drop database 数据库名 ----删除数据库
sp_who -----查看当前进程
go
kill进程ID ----删除进程,
如若提示一直处于回滚状态。
dbcc inputbuffer(ID) 查看回滚事务数据
如果能成功kill进程,则执行接下来的步骤
alter database 数据库名 set single_user
go
或 alter database 数据库名 set single_user with rollback imdelete
go
dbcc checkDB(‘数据库名’,repair_allow_data_loss)
go
update sysdatabases set status=28 where name='
置疑的数据库名
'
Go
sp_configure '
allow updates
',0
GO
reconfigure with override
Go
sp_dboption '
置疑的数据库名
', '
single
user
','
false
'
Go
------------------------------如果还是不能成功,就只能重建一个发布数据库
重建步骤:新建发布——根据提示重建分发服务器,把distribution数据库重新命名,不能重复(如:distribution1或distribution2),然后重新发布订阅即可。