Rebuild MSDB!! |
|
I had a circumstance where MSDB would not come up. It showed Recovery Pending. The files were there but it wouldn't come up. I guess I could have tried to detach and reattach but I found this solution.
I stopped all SQL related services.
From the command prompt started SQL with trace flag 3608 which only brings up master.
Net Start MSSQLSERVER /T3608
Next, detach MSDB..
SQLCMD -E -S<servername> -dmaster -Q"EXEC sp_detach_db msdb"
Run this command to then rebuild MSDB
SQLCMD -E -S <servername> -i"C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Install\instmsdb.sql" -o"C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Install\instmsdb.out"
Check this link for details!!
http://msdn.microsoft.com/en-us/library/dd207003.aspx
I stopped all SQL related services.
From the command prompt started SQL with trace flag 3608 which only brings up master.
Net Start MSSQLSERVER /T3608
Next, detach MSDB..
SQLCMD -E -S<servername> -dmaster -Q"EXEC sp_detach_db msdb"
Run this command to then rebuild MSDB
SQLCMD -E -S <servername> -i"C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Install\instmsdb.sql" -o"C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Install\instmsdb.out"
Check this link for details!!
http://msdn.microsoft.com/en-us/library/dd207003.aspx