还原Master数据库后SQLSERVER的服务无法开启
如果还原Master数据库后,SQLSERVER的服务无法开启,请注意是否因为其他的系统数据库在Master备份中记录的路径与现在的路径不一致导致的。
如果是,可以在cmd中执行“NET START MSSQLSERVER /f /T3608”把SQL SERVER实例启动到master-only恢复模式,再在SQL中执行如下列的语句,修改Master数据库中记录的其他的系统数据库的路径记录。
USE master;
GO
ALTER DATABASE mssqlsystemresource MODIFY FILE (NAME=data,FILENAME='D:\Study\SQLSERVER2005\MSSQL.1\MSSQL\DATA\mssqlsystemresource.mdf' );
ALTER DATABASE mssqlsystemresource MODIFY FILE
(NAME=log,FILENAME='D:\Study\SQLSERVER2005\MSSQL.1\MSSQL\DATA\mssqlsystemresource.ldf' );
ALTER DATABASE mssqlsystemresource SET READ_ONLY;
USE master;
GO
ALTER DATABASE model MODIFY FILE (NAME=modeldev,FILENAME='D:\Study\SQLSERVER2005\MSSQL.1\MSSQL\DATA\model.mdf' );
ALTER DATABASE model MODIFY FILE (NAME=modellog,FILENAME='D:\Study\SQLSERVER2005\MSSQL.1\MSSQL\DATA\modellog.ldf' );
GO
USE master;
GO
ALTER DATABASE msdb MODIFY FILE (NAME=MSDBData,FILENAME='D:\Study\SQLSERVER2005\MSSQL.1\MSSQL\DATA\msdbdata.mdf' );
ALTER DATABASE msdb MODIFY FILE (NAME=MSDBLog,FILENAME='D:\Study\SQLSERVER2005\MSSQL.1\MSSQL\DATA\msdblog.ldf' );
GO
USE master;
GO
ALTER DATABASE tempdb MODIFY FILE (NAME=tempdev,FILENAME='D:\Study\SQLSERVER2005\MSSQL.1\MSSQL\DATA\tempdb.mdf' );
ALTER DATABASE tempdb MODIFY FILE (NAME=templog,FILENAME='D:\Study\SQLSERVER2005\MSSQL.1\MSSQL\DATA\templog.ldf' );
GO