+1 vote
1.2k views
in Cloud by
Since yesterday, I’ve been facing an issue with my MSSQL. While applications are still working, I’m unable to access SSMS remotely. I receive the following error:

*"Database 'msdb' cannot be opened. It has been marked suspect by recovery."*

I’ve tried several solutions I found online, including setting SQL Server to single-user mode and switching the database to emergency mode, followed by running the `DBCC CHECKDB (msdb);` command to repair it. Unfortunately, none of these steps have worked.

Additionally, I’ve encountered an issue when trying to log in to SSMS in single-user mode:

*"Login failed for user 'Administrator'. Reason: Server is in single-user mode. Only one administrator can connect at this time."* (Microsoft SQL Server, Error: 18461)

I’m only able to access SQL Server through `sqlcmd` in single-user mode, but I still receive the same error stating that the `msdb` database cannot be opened when trying to set it to emergency mode and repair it. Any advice on how to resolve this would be appreciated.

1 Answer

0 votes
by
I’ve resolved this issue before. Try accessing SQL Server using `sqlcmd` from the command prompt and restore `msdb` from a backup.

Download the database file to your Downloads folder (or any preferred location) and run the following command:

RESTORE DATABASE msdb FROM DISK = 'C:\Users\Administrator\Downloads\msdb.bak' WITH REPLACE, RECOVERY;

Then type `GO` and press Enter. This should fix the issue.

If it still doesn’t work, you may need to recreate the `msdb` database.
...