1.停掉服务,建立先将mdf与ldf文件保存到别处 2.建立新的数据库。 3.用刚刚保存到别处的mdf文件来替换新建数据库的mdf文件 4.会看到数据处于置疑状态 5.进入紧急模式: use master go sp_configure 'allow updates',1 go reconfigure with override go update sysdatabases set status=-32768 where dbid=DB_ID('newtest') 6.用dbcc rebuild_log('newtest','d:\newtest.ldf')恢复日志 7.运行dbcc checkdb('newtest') 8.sp_dboption 'newtest','dbo use only','false' 恢复正常状态 9. sp_configure 'allow updates',0 go reconfigure with override go
2.建立新的数据库。
3.用刚刚保存到别处的mdf文件来替换新建数据库的mdf文件
4.会看到数据处于置疑状态
5.进入紧急模式:
use master
go
sp_configure 'allow updates',1
go
reconfigure with override
go update sysdatabases set status=-32768 where dbid=DB_ID('newtest') 6.用dbcc rebuild_log('newtest','d:\newtest.ldf')恢复日志
7.运行dbcc checkdb('newtest')
8.sp_dboption 'newtest','dbo use only','false' 恢复正常状态
9.
sp_configure 'allow updates',0
go
reconfigure with override
go
'C:\Program Files\Microsoft SQL Server\MSSQL\Data\AIS20060616101400_Data.mdf'
看看是否磁盘有坏区之类导致的吧.
分离库,否则,update sysdatabases set status=-32768 where dbid=DB_ID('newtest') 就找不到库了。