sqlserver master恢复
2012-05-07 09:32 java ee spring 阅读(307) 评论(0) 编辑 收藏 举报----故障1:master有备份
1.backup database for master
backup database master to disk='e:\master.bkf' with format
go
2.stop mssqlserver service
net stop mssqlserver
3.start sqlserver with single user mode
C:\>cd C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr -c -f -m
4.restore master database from backup files
C:\Documents and Settings\Administrator>sqlcmd
1> restore database master from disk='e:\master.bkf'
2> go
已为数据库 'master',文件 'master' (位于文件 1 上)处理了 376 页。
已为数据库 'master',文件 'mastlog' (位于文件 1 上)处理了 3 页。
已成功地还原了 master 数据库。正在关闭 SQL Server。
SQL Server 正在终止此进程。
5.start the sqlserver in normal
C:\Documents and Settings\Administrator>net start mssqlserver
SQL Server (MSSQLSERVER) 服务正在启动 ..
SQL Server (MSSQLSERVER) 服务已经启动成功。
---故障2:master只是数据库文件名或路劲不对
1.停止mssqlserver服务
net stop mssqlserver
2.修改master的mdf名字
cd C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data
ren master.mdf master01.mdf
3.net start mssqlserver
4.查看error文件
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG:
2010-02-08 12:02:00.88 Server Error: 17113, Severity: 16, State: 1.
2010-02-08 12:02:00.88 Server Error 2(系统找不到指定的文件。) occurred while opening file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf' to obtain configuration information at startup. An invalid startup option might have caused the error.
Verify your startup options, and correct or remove them if necessary.
5.按照errorlog提示修改文件名
ren master01.mdf master.mdf
6.启动
net start mssqlserver
---故障3:master没有备份
start /wait d:\setup.exe /qn instancename=mssqlserver reinstall=sql_engine rebuilddatabase=1 sapwd=sa sqlbrowserpassword=chinese_prc_bin