Travis Davies

blog

  Home  |   Contact  |   Syndication    |   Login
  7 Posts | 0 Stories | 3 Comments | 11 Trackbacks

News

Archives

Image Galleries

Music

Networking

Remote Access

I am by no means a SQL expert but due to the life of a network engineer I get to see a little of everything. If anyone has any suggestions or comments on the steps I used feel free to make them. Recently we had an issue with a client that there master database was corrupt and MSSQL would not start. We had an old backup of the master database and the .mdf and .ldf of the client databases only. Below I have listed out the steps we took to recover the master database and the client databases.


- We started sqlservr.exe as an application using the trace flag -T3608 and it gave the error:

Error: 9003, Severity: 20, State: 1.

Cannot recover the master database. Exiting.

- We then proceeded with reinstallation of sql server for a named intance:NEW. and also applied sp3.

- Started sqlservr.exe -c -m -snew

- Restore database master from disk = 'D:\SQLDATAold\mssql\BACKUP\master_db_200503130200.BAK' with replace

- Started sqlservr.exe -T3608

- Checked the consistency of the Master database using: dbcc checkdb ('MASTER') - zero consistencies

- Next detached the Model database :sp_detach_db 'model'

- Renamed the new instance model db files

- Attached the Model database using: sp_attach_db 'model','D:\sqldata\MSSQL$NEW\Data\model.mdf','D:\sqldata\MSSQL$NEW\Data\modellog.ldf'

- Then took care of the Temp db by : Alter database tempdb modify file (name= 'tempdev', filename = 'D:\sqldata\MSSQL$NEW\Data\tempdb.mdf')

Alter database tempdb modify file (name= 'templog', filename = 'D:\sqldata\MSSQL$NEW\Data\templog.ldf')

- Detached the MSDB database: sp_detach_db 'msdb' and attached it back pointing to the right location:

sp_attach_db 'msdb','D:\sqldata\MSSQL$NEW\Data\msdbdata.mdf', 'D:\sqldata\MSSQL$NEW\Data\msdblog.ldf'

- Then changed the server name by executing the following commands

- select @@servername

- sp_dropserver 'BTLAPP'

- sp_addserver 'BTLAPP\NEW', 'LOCAL'

- Attached the DOCUWARE database and checked its consistencies: dbcc checkdb ('DOCUWARE') - zero consistencies


This worked really well the only drawback is the new instance name of MSSQL. We had to change the ODBC on every client workstation to point to the new name.

posted on Wednesday, July 27, 2005 3:56 PM

Feedback

# re: How to recover a corrupt master MSSQL database. 8/13/2005 5:45 PM Ted Daniels
Your article is very useful. Our DBase Server got the Blue Screen of Death after a close lightning strike. It is a striped Adaptec array of 4 drives using SQL 2000 on Windows 2K.

We never resolved what caused the BSOD but I was able to determine thru Recovery Console that the dbase files (.mdf and .ldf) were still there.

So I just added an IDE drive to the machine, installed a new version of Windows on it, and lo, there were all my MDF and LDF files. Installed a new instance of SQL server on the IDE drive and now am about to figure out how to attach the existing files to this new SQL server instance, which is where your aticle comes in handy. I'll report back on the final steps shortly.

# re: How to recover a corrupt master MSSQL database. 8/24/2005 8:07 AM Max
I had a similar problem but only with model MSSQL database. So I just copied model.mdf and modellog.ldf from a different PC over mine files and it worked. Make sure you stoped SQL Server service on the other PC before coping files.

# re: How to recover a corrupt master MSSQL database. 9/7/2005 7:39 PM Steve B.
I have the model.mdf file but lost the modellog.ldf file. The customer does not have the original CDs so I have to locate SQL 7.0 (standard) somewhere. I thought I could just replace the file from another server but can't locate a similar server. Does this file stay the same or does it change over time?

# re: How to recover a corrupt master MSSQL database. 8/6/2006 9:25 PM AP
How to restore master database when Restored dirve is different from backup Drive.

# re: How to recover a corrupt master MSSQL database. 12/24/2008 5:30 AM mdf recovery
For recover database and db files too,try Recovery Toolbox for SQL as far as i know it has free status,also it repair data from corrupted databases in the MS SQL Server format (files with the *.mdf extension),supports data extraction via the local area network,can save recovered data as SQL scripts, it is also possible to split data into files of any size,compatible with all supported versions of Microsoft Windows, such as Windows 98, Windows Me, Windows NT 4.0, Windows 2000, Windows XP, Windows XP SP2, Windows 2003 Server, Windows Vista,tool supports the following database formats: Microsoft SQL Server 7.0, 2000, 2005,also can repair .mdf files of Microsoft SQL Server 2005, repair mdf file of Microsoft SQL Server 2005 (64-bit).


Post Feedback

Title:
Name:
Email: (never displayed)
Url:
Comments: