Summary: This blog discusses error 926 that occurs while working on SQL Server 2008 R2. It also provides solutions on how to deal with SQL Server 2008 R2 Error 926. You can also try Stellar Repair for MS SQL software to restore your database without downtime and data loss. Try the demo version of the software to preview all the recoverable database objects.
About SQL Server Error 926
Suppose you write an SQL query and are ready to execute it in SQL Server 2008 R2; but as you input the code, you get the following error message:
Database ‘msdb’ cannot be opened. It has been marked SUSPECT by recovery. See the SQL Server errorlog for more information. (Microsoft SQL Server, Error: 926).
The above error message indicates that ‘database is marked as suspect due to failed recovery process’, which prevents the database from opening. So, you will need to repair or recover MS SQL database from suspect mode to make it accessible again.
Following are some operations that result in SQL error 926:
- Starting up a SQL Server instance
- SQL database is not attached properly
- Using the RESTORE database or RESTORE LOG commands
How to Fix SQL Server 2008 R2 Error 926?
Check the SQL Server error log to identify what caused the error. If the recovery failed due to an I/O error (a torn page) or any other hardware issue, try resolving the hardware issue first to fix the error. If this doesn’t work, there must be some form of database corruption. In that case, try restoring the database from the last known database backup.
If you don’t have recent backup or the backup is corrupt, set the database in EMERGENCY mode and try the DBCC CHECKDB repair operations. Doing so will help you restore access to the database marked as suspect. But, before attempting this solution, try the following tricks to fix Microsoft SQL Server 2008 R2 Error 926 MSDB:
- Refresh the SQL connection.
- Disconnect and reconnect the SQL connection.
- Restart the service for MSSQLSERVER.
- Restart the SQL Server Management Studio (SSMS).
- Restart your desktop.
If none of the above tricks help resolve the error, perform these steps:
Step 1: Use EMERGENCY Mode to Repair a Suspect Database
Open a new query window in SSMS, and then run the following commands:
Note: You can also use the ‘sp_resetstatus’ stored procedure to turn off the suspect flag on a database. For detailed information, refer to this link.
|ALTER DATABASE DB_Name SET EMERGENCY;|
This command puts the database in EMERGENCY mode. In this mode, users only get read-only permission to access the database.
Note: Members of the sysadmin fixed server can only access this right.
|DBCC CHECKDB (‘DB_Name’);|
The above command helps check the integrity of all database objects.
|ALTER DATABASE DB_Name SET SINGLE_USER WITH ROLLBACK IMMEDIATE;|
The command sets the database in ‘single user mode’.
|DBCC CHECKDB (‘DB_Name’, REPAIR_ALLOW_DATA_LOSS);|
This DBCC CHECKDB command will help repair the errors in SQL Server 2008 R2.
|ALTER DATABASE DB_Name SET MULTI_USER;|
With this command, the SQL Server database will be set in multi-user mode, allowing multiple users to access the database.
After executing all of the above commands, check if you can access the database. If you can, put the db back in normal mode.
If this step fails, proceed with the next step.
Step 2 – Move and Detach MSDB File
You can try to recover suspect MSDB database by moving and detaching the MSDB data and log files. For this, you can use SQL Server Management Studio (SSMS) or T-SQL:
- Open Object Explorer in SSMS, right-click the connected SQL Server instance and then click Stop.
Figure 2 – Stop SQL Server Instance
2. Open Control panel, browse and select administrative tools, and then click Services.
Figure 3 – SQL Server Services
3. In ‘Services’ dialog box, locate and right-click on SQL Server (MSSQLSERVER), and then click Stop.
Figure 4 – Stop SQL Server Service
4. Open C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA.
5. Move the MSDB data file (.mdf) & log file (.ldf) to any other folder or location.
6. Copy the .mdf and .ldf files from the new location to their original location by browsing the following path:
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA
7. Restart SQL Server Service.
8. Refresh the database, and detach the MSDB file.
You can also recover the MSDB database in suspect mode by executing the below T-SQL query:
|EXEC sp_resetstatus ‘db_name’ ALTER DATABASE db_name SET EMERGENCY DBCC CHECKDB (‘db_name’) ALTER DATABASE db_name SET SINGLE_USER WITH ROLLBACK IMMEDIATE DBCC CHECKDB (‘db_name’, REPAIR_ALLOW_DATA_LOSS) ALTER DATABASE db_name SET MULTI_USER|
Note: Replace db_name with the name of your database marked as suspect.
The above code will turn off the suspect flag on the database and put it in emergency mode. Next, it will bring the database to single-user mode, repair it, and will put the database to multi-user mode.
Limitations of Resolving SQL Server Error 926 Manually
There are a few downsides to using the aforementioned manual workarounds to resolve SQL error 926:
- DBCC CHECKDB may fail to effectively repair a large-sized, severely corrupt SQL database.
- DBCC CHECKDB ‘REPAIR_ALLOW_DATA_LOSS’ command may cause some data loss.
- Loss of data integrity.
- The above steps may take too much time to resolve the Microsoft SQL server error 926.
Alternative Solution to Fix SQL Server 2008 R2 Error 926
SQL database recovery software can resolve any error, including error 926 in SQL Server causing databases to become inaccessible.
Also, the SQL database repair software can help you overcome the limitations of the above-discussed solutions, here’s how:
- It specializes in the repair and recovery of large-sized, severely corrupt SQL Server databases.
- Laced with powerful algorithms, the software can parse a SQL database and reconstruct all its objects into their original state.
- Maintain the integrity of database structure and its objects.
- Reduces the manual efforts and time a user spends in making SQL Server databases and objects accessible.
- Recommended by Microsoft SQL MVPs. Check the MVP review from here.
You can download the demo version of the SQL database repair software to ascertain its effectiveness.
Key Features of Stellar Repair for MS SQL
- Repairs corrupt MDF and NDF files
- Supports all versions of SQL Server
- Recovers all database objects, including tables, indexes, triggers, rules, keys, etc.
- Allows recovery of deleted SQL Server records
- Supports multiple file saving options like MS SQL, CSV, HTML, and XLS
- Capable of resolving all type of corruption errors.
You can use manual fixes and software to deal with SQL Server 2008 R2 Error 926. While the manual fixes may help you fix the error, they may take considerable time and effort in resolving the error. This increases server downtime, leading to productivity loss and chances of data loss. However, using SQL repair software may help you restore the database in minimal time without the fear of losing any data.