复制代码 代码如下:
--DataBaseName为修复的数据名
USE MASTER
GO
SP_CONFIGURE 'ALLOW UPDATES',1 RECONFIGURE WITH OVERRIDE
GO
ALTER DATABASE [DataBaseName] SET EMERGENCY
GO
sp_dboption 'DataBaseName', 'single user', 'true'
GO
DBCC CHECKDB('DataBaseName','REPAIR_ALLOW_DATA_LOSS')
GO
ALTER DATABASE [DataBaseName] SET ONLINE
GO
sp_configure 'allow updates', 0 reconfigure with override
GO
sp_dboption 'DataBaseName', 'single user', 'false'
GO
复制代码 代码如下:
CREATE DATABASE DataBaseName
ON (FILENAME = 'D:/DataBase/Name.mdf')
FOR ATTACH_REBUILD_LOG ;
GO
新闻热点
疑难解答