Microsoft Sql Server 2008 Error 945 Msdb Suspect

Posted on by
Microsoft Sql Server 2008 Error 945 Msdb Suspect Average ratng: 3,5/5 3287 reviews

Using SQL Server Management Studio To manage the suspect_pages table. In Object Explorer, connect to an instance of the SQL Server Database Engine, expand that instance, and then expand Databases. Expand System Databases, expand msdb, expand Tables, and then expand System Tables. Expand dbo.suspect_pages and right-click Edit Top 200 Rows. Problem: I have got this problem in local instance of SQL Server 2008 R2 on my machine.There are several databases on this instance. But I am not able to see any of them from the object explorer. I am able to query my databases from the new query window. Home / ASP.NET Forums / Data Access / SQL Server, SQL Server Express, and SQL Compact Edition / Database 'msdb' cannot be opened. It has been marked SUSPECT by recov. It has been marked SUSPECT by recov. I think it will be valuable for all kinds of Users.Please continue How To Recover Msdb Database From Suspect Mode In Sql Server 2008 work for me. You can read more about what I have not started Is 'youth' Excelente.

  1. Sql Server Error 924
  2. Microsoft Sql Server 2008 Error 945 Msdb Suspects
  3. Sql Server Errors List
  4. Microsoft Sql Server 2008 Error 4064
By: Daniel Farina Last Updated: 2015-06-24 Comments (9) Related Tips: More >Disaster Recovery

Problem

You have to fix a corrupt SQL Server msdb database and to make things worse, there is no recent database backup. If you run setup with the option REBUILDDATABASE you will also rebuild the master database and lose all the logins unless you backup and restore the master database. Is this the best option? Keep reading and you will see that there is another way to rebuild the msdb database without compromising the master database.

Solution

Dealing with corruption of system databases is one of the most feared situations for SQL Server DBAs. Luckily, there are a few different options to fix the corrupt SQL Server instance to get back up and running. You can get a list of those methods in John Grover's tip on How to recover a suspect msdb database in SQL Server. The last method John proposes in his tip is to 'Use a SQL Server Template MSDB Database', but this option has two paths depending on what SQL Server version you are working with. If you have an instance of SQL Server 2008 or later, you can copy the database template in the BinnTemplates subfolder of the instance root directory. But if you are working with a previous version then you have to use the method that I will expose in this tip.

Most of the articles about msdb database corruption refer to a physically corrupted database, but what if instead you have logical corruption? I mean, for example if someone accidentally or deliberately modified some of the stored procedures of the msdb database. In that case, using the template msdb database won't be the best approach because you will lose all the job definitions, Integration Services Packages stored in msdb, etc.

The possible solution to the previous scenario relies on the Install subfolder of SQL Server instance root directory, which is usually C:Program FilesMicrosoft SQL ServerMSSQL13.MSSQLSERVERMSSQLInstall. There is a file in that folder named instmsdb.sql which is the msdb creation script. Let's see how we can use it.

Option 1 - Rebuild a Corrupt msdb SQL Server Database

This procedure is quite straightforward. It consists of starting the SQL Server instance with trace flag 3608. This trace flag prevents the instance from automatically recovering any database except master. But databases will be started and recovered when accessed, so if we want to rebuild the msdb database it is a wise to avoid connections to that database.

The first step is to stop the SQL Server Instance and all the dependent services like Integration Services, Analysis Services, Reporting Services and any other application that use SQL Server. You can use any administrative tool for that purpose like the Services Manager. The screen shot below shows a command window with the commands (i.e. NET STOP '/f' parameter is to start SQL Server service with its minimal configuration and in single user mode; we want to be the only ones to access the instance. The last parameter /m'SQLCMD' tells the instance to only accept connections for an application that identifies as SQLCMD. That's to avoid other applications to connect to the instance.

After the instance starts up, we open a Command window and change the folder to the install folder of the instance root directory and from there we connect to it with the SQLCMD application and detach the msdb database.

The –E parameter is used to establish a trusted connection, you can use a SQL Server login like sa if you want to. The –Q parameter executes the quoted commands and exits.

Please do not stop elaborating. I realise I'm almost the only person posting in this thread, but if anyone would like me to elaborate further on any element of the above I'd be happy to. Said: Now time to twiddle. If it helps, I'd like to plug it into my midi guitar, so therefore the small size of the Quicco could just hang out, however the Yamaha would be a bit annoying like that. No apparent latency to dampen my bluetooth ardour. Fm radio bluetooth transmitter.

Microsoft Sql Server 2008 Error 945 Msdb Suspect

Now you can stop the instance and start it up again normally, I mean without any special consideration.

Sql server errors list

The next step is to rename the msdb database files; otherwise the next step will fail. By default these files are in the DATA sub-folder for the SQL Server instance.

If you try to connect to the instance using SQL Server Management Studio you will get an error message, but you can still use SQL Server Management Studio by selecting NewDatabase Engine Query, like on the next image.

Now to recreate the msdb database you can use the next SQLCMD command.

The '-iinstmsdb.sql' parameter instructs SQLCMD to execute the instmsdb.sql script, of course you have to be in the same folder as the script. The '–ologfile.txt' option will save the output to a file named logfile.txt in the same folder.

Sql Server Error 924

Also you can execute this script by dragging the instmsdb.sql file into SQL Server Management Studio. The next image is a screen capture showing the execution.

Option 2 - Recover Stored Procedures in the SQL Server msdb Database

If your msdb database has altered stored procedure and you want to get them back to the original version, you can get the original code from the instmsdb.sql file. I tested that if you run the instmsdb.sql script it won't drop and recreate the system tables in msdb if they exist, but it will drop and recreate the stored procedures. The next script was copied from instmsdb.sql file and intends to create the sysjobs table. Notice that the CREATE TABLE statement is inside an IF block that is executed if the sysjobs table doesn't exist, so it doesn't try to recreate the table.

In contraposition, the next script also extracted from instmsdb.sql script creates the sp_agent_start_job stored procedure. Notice that before the CREATE PROCEDURE there is an IF block that drops the sp_agent_start_job stored procedure if it exists.

The best part of this fix is that you don't have to stop the instance and start it with a trace flag in order to execute the instmsdb.sql script. The next three images are screen captures that I took showing the contents of the sysjobs table before executing instmsdb.sql script, the script execution and the contents of the sysjobs table after executing instmsdb.sql script.

Here we can see that there is one job called SampleJob.

Microsoft Sql Server 2008 Error 945 Msdb Suspects

In the next screen shot we see the execution of instmsdb.sql.

In this final screenshot after instmsdb.sql has been run, we can see that job SampleJob still exists. So all of the data stays intact after running instmsdb.sql against an existing msdb database.

Next Steps
  • The following tip will go through the basics of system databases: SQL Server System Databases.
  • To learn about how to safeguard system databases take a look at Best Practices Backup System Databases in SQL Server.
  • This tip will show you step by step the process of Restoring SQL Server system databases msdb and model.
  • The following tip shows other ways to recover the msdb database: How to recover a suspect msdb database in SQL Server.
  • Check out System Databases Tips Category.

Sql Server Errors List


Last Updated: 2015-06-24



About the author

Microsoft Sql Server 2008 Error 4064

Daniel Farina was born in Buenos Aires, Argentina. Self-educated, since childhood he showed a passion for learning.
View all my tips