Sql-server – Unable to start SQL Server Instance 2008 R2 – DB file corrupt

sql serversql-server-2008sql-server-2008-r2

I was not able to start the SQL Server 2008 R2 production DB instance. After reading the log file error message is

" The log scan number passed to log scan in database ‘master’ is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication."

After reading several post i realize that my MASTER DB file is corrupted. I have followed the below setup

Copy the Master.mdf and Masterlog.ldf file from Template location to My Database Data folder.

C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Binn\Templates to D:\MSSQL\MSSQL10_50.MSSQLSERVER\MSSQL\DATA

Note: Same error occur when i copy the all DB file like Master, MasterLog, MSDBData, MSDBlog, Model and ModelLog

When i run my MSSQLSEVER instance different problem occur.

In My server i had only C, D- Drive i dont have the E drive. How can i override these below error path.

Error LOG

2012-10-24 02:51:12.79 spid5s Error: 17204, Severity: 16, State: 1.

2012-10-24 02:51:12.79 spid5s FCB::Open failed: Could not open file e:\sql10_main_t.obj.x86fre\sql\mkmastr\databases\objfre\i386\MSDBData.mdf for file number 1. OS error: 3(The system cannot find the path specified.).

2012-10-24 02:51:12.79 spid5s Error: 5120, Severity: 16, State: 101.

2012-10-24 02:51:12.79 spid5s Unable to open the physical file

"e:\sql10_main_t.obj.x86fre\sql\mkmastr\databases\objfre\i386\MSDBData.mdf". Operating system error 3: "3(The system cannot find the path specified.)".

2012-10-24 02:51:12.79 spid5s Error: 17207, Severity: 16, State: 1.

2012-10-24 02:51:12.79 spid5s FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'e:\sql10_main_t.obj.x86fre\sql\mkmastr\databases\objfre\i386\MSDBLog.ldf'. Diagnose and correct the operating system error, and retry the operation.

2012-10-24 02:51:12.79 spid5s File activation failure. The physical file name "e:\sql10_main_t.obj.x86fre\sql\mkmastr\databases\objfre\i386\MSDBLog.ldf" may be incorrect.

Best Answer

Look here http://msdn.microsoft.com/en-us/library/dd207003.aspx. It's for 2012 but 2008 is basically the same. It describes how to use the setup.exe to rebuild the system databases. From there you have to do restores for your system databases & patch your instance but it works. If you don't have backups of your system databases you can copy the files off (not master obviously) and copy them back after the rebuild. It's not recommended but it will work.