如果还原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:StudySQLSERVER2005MSSQL.1MSSQLDATAmssqlsystemresource.mdf' );
ALTER DATABASE mssqlsystemresource MODIFY FILE
(NAME=log,FILENAME='D:StudySQLSERVER2005MSSQL.1MSSQLDATAmssqlsystemresource.ldf' );
ALTER DATABASE mssqlsystemresource SET READ_ONLY;
USE master;
GO
ALTER DATABASE model MODIFY FILE (NAME=modeldev,FILENAME='D:StudySQLSERVER2005MSSQL.1MSSQLDATAmodel.mdf' );
ALTER DATABASE model MODIFY FILE (NAME=modellog,FILENAME='D:StudySQLSERVER2005MSSQL.1MSSQLDATAmodellog.ldf' );
GO
USE master;
GO
ALTER DATABASE msdb MODIFY FILE (NAME=MSDBData,FILENAME='D:StudySQLSERVER2005MSSQL.1MSSQLDATAmsdbdata.mdf' );
ALTER DATABASE msdb MODIFY FILE (NAME=MSDBLog,FILENAME='D:StudySQLSERVER2005MSSQL.1MSSQLDATAmsdblog.ldf' );
GO
USE master;
GO
ALTER DATABASE tempdb MODIFY FILE (NAME=tempdev,FILENAME='D:StudySQLSERVER2005MSSQL.1MSSQLDATA empdb.mdf' );
ALTER DATABASE tempdb MODIFY FILE (NAME=templog,FILENAME='D:StudySQLSERVER2005MSSQL.1MSSQLDATA emplog.ldf' );
GO