Morgan Systems
Find 
  Development Notes and Bugfixes  
   

Select Article

We burn the midnight oil so you don't have to.
 
   
   
   
   
   
   
   
   
   
   
   
   






 

MSDB Corrupt Log

An easy fix for a corrupt MSDB log file

MSDB Corrupt Log

Despite the variety of posts you will find declaring you must recreate MSDB if you have no backup, there is an easy fix for a corrupt transaction log on this database.

Start by stopping the SQL server service.  Then, copy the corrupt MSDB data file (only), and rename it (I just put an "x" in front).

Now restart SQL Server.

Next, use the following command to mount the copy as a regular database, with the instruction to recreate an empty log.

CREATE DATABASE xmsdb ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\xMSDBdata.mdf') FOR ATTACH_REBUILD_LOG;

Now Set the new database to single user and run DBCC:

alter database xmsdb set single_user
dbcc checkdb('xmsdb', REPAIR_ALLOW_DATA_LOSS);

Finally, detach that database, stop SQL server, rename the msdb files to something else (just for safety), and rename the xmsdb files to the original msdb file names. Then restart SQL Server.

Comments

Add your comments

Name:
E-Mail:   We will not display your email address.
Comments: