Table of Content
    SQL Database Repair

    How to Resolve SQL Server Error 211?


    Table of Content

      Summary: The SQL Server error 211 occurs due to corruption in schema or database. In this post, we’ll discuss the solutions to resolve this error. We’ll also mention a third-party SQL repair software that can help fix the error by repairing the corrupt SQL Server database.

      When trying to update a table in SQL Server, you may receive an error message, such as:

      Msg: 211, Level 23, State 51, Line 1 Possible schema corruption.
      Run DBCC CHECKCATALOG
      Msg 0, Level 20, State 0, Line 0

      This error is usually related to a problem with the schema or corruption in schema. The schema is generally a collection of objects in SQL Server, such as tables, related columns, its entries, and other items.

      Such an issue may occur due to:

      • Problem with software or a software failure.
      • Problem with hardware or failure of hardware, like disk failure.

      How to Resolve the Issue?

      Follow the below solutions to resolve the issue.

      Restore from Backup

      If you have a backup, the best solution is to restore your data from the backup.

      • To backup your database, in SSMS, go to the Object Explorer and right-click the database and select Tasks > Back Up.
      Image of Database being backed up from Object Explorer under Tasks in the SSMS to fix SQL Server error 211
      • Select the Destination and the Backup Type, and then press OK.
      Image of Back up Destination of the database to fix SQL Server error 211

      If you need to back up the database using the T-SQL, use the following command:

      BACKUP DATABASE [stellar] TO DISK = N’C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER03\MSSQL\Backup\stellar_LogBackup_2023-01-19_16-58-07.bak’ WITH NOFORMAT, NOINIT, NAME = N’stellar-Full Database Backup’
      GO

      • To restore the database, open the SSMS.
      • Go to the Object Explorer, right-click the database, and select the Restore Database option from the context menu.
      Image of Restore Database by right-clicking on the database in the object explorer to fix SQL Server error 211
      • In the Database combo box, select the database that you want to restore. Select the Backup sets to restore.
      Image of database selected to restore

      Alternatively, you can run the following T-SQL command to restore the database:

      USE [master]
      BACKUP LOG [stellar] TO DISK = N’C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER03\MSSQL\Backup\stellar_LogBackup_2023-01-19_18-19-32.bak’ WITH NOFORMAT, NOINIT, NAME = N’stellar_LogBackup_2023-01-19_18-19-32′, NOSKIP, NOREWIND, NOUNLOAD, NORECOVERY , STATS = 5
      RESTORE DATABASE [stellar] FROM DISK = N’C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER03\MSSQL\Backup\stellar.bak’ WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 5
      RESTORE LOG [stellar] FROM DISK = N’C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER03\MSSQL\Backup\stellar_LogBackup_2023-01-19_13-00-38.bak’ WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 5
      RESTORE LOG [stellar] FROM DISK = N’C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER03\MSSQL\Backup\stellar_LogBackup_2023-01-19_16-58-07.bak’ WITH FILE = 1, NOUNLOAD, STATS = 5
      GO

      Run DBCC CHECKCATALOG Command

      You can also run the DBCC CHECKCATALOG command to fix the issue. This command is used to verify the catalog consistency. To run this command, the database must be in single-user mode.

      Here’s the command:

      DBCC CHECKCATALOG (databasename)

      The following example shows how to run the CHECKCATALOG command without displaying information messages.

      DBCC CHECKCATALOG(stellar)  WITH NO_INFOMSGS

      However, in our case, we want to see the error message.

      • To repair the database, run the DBCC CHECKDB command.

      USE master;
      GO
      ALTER DATABASE stellar
      SET SINGLE_USER
      WITH ROLLBACK IMMEDIATE;
      GO

      DBCC CHECKDB(‘stellar’,REPAIR_REBUILD)
      GO
      ALTER DATABASE stellar
      SET MULTI_USER;
      GO

      • After repairing the database, set the database to multi-user mode.
      • You can also use SSMS to set the database in single-user mode or multiple-user mode.
      • In the Object Explorer, right-click the database and go to Properties.
      Image of selecting Properties by right-clicking on the database in the object explorer
      • Go to the Options page and change the Restrict Access according to your needs.
      Image of Options Page in database properties and change restrict access according to your needs

      Use a Third-party SQL Repair Software

      Another solution is to use a third-party SQL database repair software, such as Stellar Repair for MS SQL. This software basically repairs the database file. The data files are files with the MDF extension. You need to set the database offline and then repair it using this software.

      Conclusion

      In this article, we’ve discussed the solutions to fix the SQL Server error 211. You can recover the database from the backup. You can run the DBCC CHECKCATALOG command or repair the database using the CHECKDB command. If everything fails, use Stellar Repair for MS SQL to repair the database and recover all its objects.

      Was this article helpful?

      No NO

      About The Author

      Bharat Bhushan linkdin

      Bharat Bhushan is an experienced technical Marketer working at Stellar Data Recovery - expertise in data care. He is skilled in Microsoft Exchange Database, MSSQL Database troubleshooting & data warehousing. He is a Management Post Graduate having a strong grip in Technology & certified in SAP-SD, Oracle 10g & Informatica Powercenter 9.1.

      Leave a comment

      Your email address will not be published. Required fields are marked *

      Image Captcha
      Refresh Image Captcha

      Enter Captcha Here :

      Related Posts

      WHY STELLAR® IS GLOBAL LEADER

      Why Choose Stellar?

      • 0M+

        Customers

      • 0+

        Years of Excellence

      • 0+

        R&D Engineers

      • 0+

        Countries

      • 0+

        PARTNERS

      • 0+

        Awards Received