处理时方法如下(以超市之星为例):
步骤1:
创建一个新的数据库,命名为原来数据库的名字。
步骤2:
停止SQL Server
步骤3:
把老数据库的MDF文件替换新数据库的相应的MDF文件,并把LDF文件删除。
步骤4:
重新启动SQL Server服务,然后运行如下命令:
Use Master Go
sp_configure 'allow updates', 1
reconfigure with override Go
begin tran
update sysdatabases set status = 32768 where name = 'hbposv5'
--Verify one row is updated before committing
commit tran
步骤5:
停止SQL然后重新启动SQL Server服务,然后运行如下命令:
DBCC TRACEON(3604)
DBCC REBUILD_LOG('hbposv5','c:\\mssql7\\data\\hbposv5_log.ldf')
Go
步骤6:
停止SQL然后重新启动SQL Server服务,然后运行:
use master
update sysdatabases set status = 8 where name = 'hbposv5' Go
sp_configure 'allow updates', 0
reconfigure with override Go
步骤7:
运行dbcc checkdb(hbposv5) 检查数据库的完整性或者用bcp修复
注:都要替换成真实的数据库名字。