{"id":48632,"date":"2020-01-07T06:24:43","date_gmt":"2020-01-07T06:24:43","guid":{"rendered":"https:\/\/www.stellarinfo.com\/blog\/?p=48632"},"modified":"2026-04-24T12:00:45","modified_gmt":"2026-04-24T12:00:45","slug":"how-to-repair-sql-database-using-dbcc-checkdb-command","status":"publish","type":"post","link":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/","title":{"rendered":"How to Repair SQL Database using DBCC CHECKDB Command?"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><?xml encoding=\"utf-8\" ?><p>DBCC CHECKDB is a built-in command in Microsoft SQL server used to check and repair the logical and physical integrity of SQL database. As per <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/database-console-commands\/dbcc-checkdb-transact-sql?view=sql-server-ver17\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Microsoft document<\/a>, it is one of the Database Console Commands (DBCC) in SQL Server to manage, maintain and provide options to repair MDF file corruption. It scans tables, indexes, allocation structures, logical issues and broken links around pages.<\/p><p>This command is a critical tool in SQL DBA&rsquo;s toolkit, database Administrators (DBAs) use it as the diagnostic tool when their database enters suspect mode, fails to come online or they encounter integrity errors on database. It not only helps to check database&rsquo;s integrity but also recommend the minimum repair level required to resolve the corruption problem.<\/p><blockquote class=\"note_alert\">\n<p><strong>Source <\/strong>: SQL Microsoft guide <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/database-console-commands\/dbcc-checkdb-transact-sql\" type=\"link\" id=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/database-console-commands\/dbcc-checkdb-transact-sql\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">database console commands<\/a><\/p>\n<\/blockquote><p>Here is the most basic form of the command. Replace 3.Bonus2 with your actual database name:<\/p><pre class=\"wp-block-code command_container\"><code><code>DBCC CHECKDB ('3.Bonus2&nbsp;');<\/code><\/code><\/pre><p><strong>When DBCC CHECKDB finds no problems:<\/strong><\/p><p>CHECKDB found 0 allocation errors and 0 consistency errors in database &lsquo;3.Bonus2&rsquo;.DBCC execution completed. If DBCC printed error messages, contact your system administrator.<\/p><p><strong>When DBCC CHECKDB detects corruption:<\/strong><\/p><p>Msg 824, Level 24, State 2, Line 5<\/p><p>SQL Server detected a logical consistency-based I\/O error: incorrect checksum (expected: 0x4a3c2f1e; actual: 0x8b1d9f2a).<\/p><p>It occurred during a read of page (1:47623) in database ID 7 at offset 0x000000175c6000 in file &lsquo;D:\\Data\\3.Bonus2&nbsp;.mdf&rsquo;.<\/p><p>When the command reports errors like that, it also suggests the minimum repair level needed. This blog explains in detail &ndash; how to use the DBCC CHECKDB command to repair the SQL database.<a id=\"_msocom_1\"><\/a><\/p><figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Troubleshooting Corrupt Database with DBCC CHECKDB - Solving Msg 824 logical consistency I\/O error\" width=\"750\" height=\"422\" src=\"https:\/\/www.youtube.com\/embed\/czXGeS3EZG8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure><h2 class=\"wp-block-heading\" id=\"what-dbcc-checkdb-checks?\">What DBCC CHECKDB Checks?<\/h2><p>This SQL server command performs the consistency checks on database pages, allocation pages, index relationships, etc. The <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/database-console-commands\/dbcc-checkdb-transact-sql?view=sql-server-ver17\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">key checks that this command runs internally<\/a> include:<\/p><h3 class=\"wp-block-heading\"><strong>Disk space allocation consistency<\/strong><\/h3><p>Runs DBCC CHECKALLOC to ensure that pages and extents are properly allocated across the database.<\/p><h3 class=\"wp-block-heading\"><strong>Table and view integrity<\/strong><\/h3><p>Executes DBCC CHECKTABLE on every table and view to verify structural consistency.<\/p><h3 class=\"wp-block-heading\"><strong>Database-wide consistency<\/strong><\/h3><p>Performs checks across the entire database to detect corruption or logical inconsistencies.<\/p><h3 class=\"wp-block-heading\"><strong>Indexed views validation<\/strong><\/h3><p>Confirms that the contents of every indexed view are correct and consistent.<\/p><h3 class=\"wp-block-heading\"><strong>FILESTREAM data validation<\/strong><\/h3><p>Validates link-level consistency between table metadata and the file system when storing varbinary(max)  data using <a href=\"https:\/\/www.stellarinfo.com\/blog\/fix-sql-server-filestream-database-corruption\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">FILESTREAM in database<\/a>.<\/p><h3 class=\"wp-block-heading\"><strong>Service Broker data validation<\/strong><\/h3><p>Ensures that Service Broker objects and data are intact and consistent.<\/p><h2 class=\"wp-block-heading\" id=\"what-causes-sql-server-database-corruption?\"><strong>What Causes SQL Server Database Corruption?<\/strong><\/h2><p>Corruption in MDF\/NDF files can occur due to various reasons.&nbsp; Most common reasons are below:<\/p><figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Logical Corruption Causes<\/strong><\/td><td><strong>Physical Corruption Causes<\/strong><\/td><\/tr><tr><td>Abrupt System\/Application shutdown during a write<\/td><td>&nbsp;Hard disk failures (bad sectors, read errors, controller faults)<\/td><\/tr><tr><td>SQL Server instance crash mid-operation &mdash; can leave page splits or index splits partially written<\/td><td>Faulty RAM<\/td><\/tr><tr><td>Operating system or file-system error &mdash; NTFS can mask I\/O errors, allowing a partially-written page to appear committed when it is not.<\/td><td>Ransomware attack &mdash; encrypts or overwrites MDF\/NDF file bytes directly, producing checksum mismatches across thousands of pages simultaneously.<\/td><\/tr><tr><td>Improperly detaching a database and editing or moving the .mdf file outside of SQL Server can corrupt headers or log sequence numbers (LSNs).<\/td><td>Disk controller driver bug<\/td><\/tr><\/tbody><\/table><\/figure><blockquote class=\"note_alert\">\n<p><em><strong>Source:<\/strong> <\/em><a href=\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/\" type=\"post\" id=\"48632\">Microsoft SQL Server documentation &mdash; <em>Understanding How Errors Propagate in SQL Server<\/em><\/a><em>. <\/em><\/p>\n<\/blockquote><h2 class=\"wp-block-heading\" id=\"how-the-dbcc-checkdb-command-works?\"><strong>How the DBCC CHECKDB Command Works?<\/strong><\/h2><p>The command thoroughly scans the database and performs integrity checks and other structural checks. If any of these checks fail, it displays <a href=\"https:\/\/www.stellarinfo.com\/blog\/fix-sql-server-database-dbcc-checkdb-consistency-errors\/\" target=\"_blank\" rel=\"noreferrer noopener\">consistency errors<\/a> indicating issues in the database and also recommend appropriate repair option. Let&rsquo;s take a look at the syntax of DBCC CHECKDB command.<\/p><pre class=\"wp-block-code command_container\"><code>DBCC CHECKDB&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp; [ ( db_name | db_id | 0&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ , NOINDEX&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | , { REPAIR_ALLOW_DATA_LOSS | REPAIR_FAST | REPAIR_REBUILD } ]&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp; ) ]&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp; [ WITH&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ ALL_ERRORMSGS ]&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ , EXTENDED_LOGICAL_CHECKS ]&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ , NO_INFOMSGS ]&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ , TABLOCK ]&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ , ESTIMATEONLY ]&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ , { PHYSICAL_ONLY | DATA_PURITY } ]&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ , MAXDOP&nbsp; = number_of_processors ]&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp; ]&nbsp;&nbsp;&nbsp;\n]<\/code><\/pre><blockquote class=\"note_alert\">\n<p>In the syntax above, replace db_name with your actual database name. In all examples throughout this guide, we use [3.Bonus2&nbsp;] &mdash; replace this with your database name.<\/p>\n<\/blockquote><p><a id=\"_msocom_1\"><\/a>Now, let&rsquo;s understand the various options used in the above DBCC CHECKDB command.<\/p><ul class=\"wp-block-list\">\n<li><strong>database_name | database_id | 0:&nbsp;<\/strong>Specifies the name or ID of the database against which you need to run integrity checks. If the &lsquo;database_name&rsquo; or &lsquo;id&rsquo; is not specified and &lsquo;0&rsquo; is specified, the current database will be used by default.<\/li>\n\n\n\n<li><strong>NOINDEX:<\/strong>&nbsp;Performs only logical checks to reduce the total execution time. It does not include non-clustered indexes in the checks.<\/li>\n\n\n\n<li><strong>REPAIR_FAST:&nbsp;<\/strong>REPAIR_FAST was deprecated in SQL Server 2012 and removed in SQL Server 2016. Do NOT use on SQL Server 2016 or later &mdash; it will return an error. It accepted the syntax on older versions but performed no repair actions, <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/database-console-commands\/dbcc-transact-sql?view=sql-server-ver17\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">according to Microsoft<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.stellarinfo.com\/blog\/dbcc-checkdb-repair-rebuild\/\">REPAIR_REBUILD<\/a><strong>:&nbsp;<\/strong>Helps repair database without any data loss. It can be used to repair missing rows in non-clustered indexes and for rebuilding an index.<\/li>\n\n\n\n<li><strong>REPAIR_ALLOW_DATA_LOSS:&nbsp;<\/strong>This option tries to fix all the reported issues and errors. Use this option as a last resort as it can lead to data loss.&nbsp;<\/li>\n\n\n\n<li><strong>ALL_ERRORMSGS:&nbsp;<\/strong>This argument displays all the error messages for each object.<\/li>\n\n\n\n<li><strong>EXTENDED_LOGICAL_CHECKS:&nbsp;<\/strong>Use this option to perform additional checks.<\/li>\n\n\n\n<li><strong>NO_INFOMSGS:&nbsp;<\/strong>DBCC output displays informational messages that are not related to the consistency errors. This option turns off the informational messages.<\/li>\n\n\n\n<li><strong>TABLOCK:&nbsp;<\/strong>Uses locks rather than internal database snapshot to perform consistency checks on the database.<\/li>\n\n\n\n<li><strong>ESTIMATEONLY:&nbsp;<\/strong>Specifies the estimated space required by the &lsquo;tempdb&rsquo; database for executing the CHECKDB command.<\/li>\n\n\n\n<li><strong>PHYSICAL_ONLY:&nbsp;<\/strong>Limits consistency checks on the physical structure of the database page, reducing runtime for DBCC CHECKDB on large databases.<\/li>\n\n\n\n<li><strong>DATA_PURITY:<\/strong>&nbsp;Helps check database for invalid or out-of-range column values.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"prerequisites-for-using-dbcc-checkdb-command\">Prerequisites for using DBCC CHECKDB command<\/h2><p>To run DBCC CHECKDB command first check the following things:<\/p><ul class=\"wp-block-list\">\n<li>Make sure the database on which you&rsquo;re trying to run this command is not detached, or in recovery pending state.<\/li>\n\n\n\n<li>Check the permissions and roles on the database. Make sure you have sysadmin fixed server role or db_owner role<a>.<\/a>&nbsp;<\/li>\n\n\n\n<li>DBCC CHECKDB uses TempDB heavily for internal checks, so your system should have sufficient space.<\/li>\n\n\n\n<li>To use its repair option on the database, your database should run in a single-user mode.<a id=\"_msocom_1\"><\/a><a id=\"_msocom_1\"><\/a><\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"how-to-run-dbcc-checkdb-command-to-check-corruption?\">How to run DBCC CHECKDB command to check corruption?<\/h2><p>If you&rsquo;re able to attach database (MDF\/NDF) file then you can use the DBCC CHECKDB command. You can use it to check database file for corruption. If you fail to access the database, then change its status to <strong>Emergency <\/strong>mode to provide read-only access to the administrator.<\/p><p>To set the database in EMERGENCY mode, run the below command:<\/p><pre class=\"wp-block-code command_container\"><code><code>ALTER DATABASE [3.Bonus2] SET EMERGENCY<\/code><\/code><\/pre><p>Once you can access the database then, here&rsquo;s how to use this command to check the corruption in SQL data files:<\/p><pre class=\"wp-block-code command_container\"><code><code>DBCC CHECKDB ( [3.Bonus2])<\/code><\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"467\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-to-check-database-for-corruption-1-1024x467.png\" alt=\"Running DBCC CHECKDB Command  To Check Database For Corruption\" class=\"wp-image-191430 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-to-check-database-for-corruption-1-1024x467.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-to-check-database-for-corruption-1-300x137.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-to-check-database-for-corruption-1-768x350.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-to-check-database-for-corruption-1.png 1334w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>The CHECKDB command can have performance implications. However, you can use the right parameters in it to minimize performance impact on SQL server. Some few ones are below:<\/p><p><strong>Use DBCC CHECKDB with NO_INFOMSGS<\/strong><\/p><p>You can run the NO_INFOMSGS option with CHECKDB to display only the consistency errors instead of thousands of informational lines. It helps to cut down the processing time considerably when integrity checks are performed on small databases in SQL Server Management Studio (SSMS). Here&rsquo;s the command:<\/p><pre class=\"wp-block-code command_container\"><code>DBCC CHECKDB([3.Bonus2]) with NO_INFOMSGS;<\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"482\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-no-infomsgs-1024x482.png\" alt=\"Running DBCC CHECKDB with NO-INFOMSGS\" class=\"wp-image-191410 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-no-infomsgs-1024x482.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-no-infomsgs-300x141.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-no-infomsgs-768x361.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-no-infomsgs.png 1126w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><blockquote class=\"note_alert\">\n<p><strong>Note<\/strong>:&nbsp;Using <strong>NO_INFOMSGS<\/strong> does not minimize a performance issue but it can prevent you from running the integrity checks again by showing you only the errors. Also, use this option for small databases&lt;=1TB.<\/p>\n<\/blockquote><p><strong>DATA_PURITY<\/strong><\/p><p>The DBCC CHECKDB performs column-value integrity checks by default. However, in case you have upgraded databases from previous versions then can use the DATA_PURITY option. Here is the command:<\/p><pre class=\"wp-block-code command_container\"><code><code>DBCC CHECKDB([3.Bonus2]) with DATA_PURITY;<\/code><\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"498\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-data-purity-1024x498.png\" alt=\"Running DBCC CHECKDB with DATA_PURITY\" class=\"wp-image-191412 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-data-purity-1024x498.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-data-purity-300x146.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-data-purity-768x374.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-data-purity.png 1340w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p><strong>EXTENDED_LOGICAL_CHECKS<\/strong><\/p><p>If you suspect your database is corrupted then you can perform logical checks on its indexed view, special indexes or XML indexes. To do so, run the following command:<\/p><pre class=\"wp-block-code command_container\"><code><code>DBCC CHECKDB([3.Bonus2]) with EXTENDED_LOGICAL_CHECKS;<\/code><\/code><\/pre><p>In SQL Server 2016, running the DBCC CHECKDB command with the EXTENDED_LOGICAL_CHECKS option may fail on a table that has a &ldquo;filtered non-clustered index (NCI) over a clustered columnstore index (CCI)&rdquo;. Also, it will result in <a href=\"https:\/\/support.microsoft.com\/en-us\/topic\/fix-dbcc-checkdb-with-extended-logical-checks-fails-on-a-table-in-sql-server-2016-bfb65df4-d061-02f3-5660-5fed9f6caa3e\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">SQL error 5297<\/a>.<\/p><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"654\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbccc-checkdb-with-extended-logical-checks-1024x654.png\" alt=\"Running DBCCC CHECKDB WITH EXTENDED LOGICAL CHECKS\" class=\"wp-image-191413 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbccc-checkdb-with-extended-logical-checks-1024x654.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbccc-checkdb-with-extended-logical-checks-300x192.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbccc-checkdb-with-extended-logical-checks-768x491.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbccc-checkdb-with-extended-logical-checks.png 1036w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p><strong>PHYSICAL_ONLY<\/strong><\/p><p>You can reduce the overhead of DBCC CHECKDB and make it faster for larger databases using it with&nbsp;&ldquo;PHYSICAL_ONLY&rdquo;&nbsp;option. DBCC CHECKDB skips all the logical checks and limits the checking to physical structure of a page. It also helps validate page checksums for failure, torn pages, and common hardware failures that can lead to data corruption. To use DBCC CHECKDB with PHYSICAL_ONLY, use this syntax:<\/p><pre class=\"wp-block-code command_container\"><code><code>DBCC CHECKDB([3.Bonus2]) with PHYSICAL_ONLY<\/code><\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"487\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-pysical-only-1024x487.png\" alt=\"Running DBCC CHECKDB  wITH Physical Only \" class=\"wp-image-191414 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-pysical-only-1024x487.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-pysical-only-300x143.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-pysical-only-768x365.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-with-pysical-only.png 1188w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><h2 class=\"wp-block-heading\" id=\"dbcc-checkdb-output-explained\">DBCC CHECKDB Output Explained<\/h2><p>If DBCC CHECKDB shows &ldquo;0&rdquo; allocation errors as shown below means your database is healthy.<\/p><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"480\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/dbcccheckdb-output-with-o-errors-1024x480.png\" alt=\"DBCC CHECKDB  output with o errors\" class=\"wp-image-191415 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/dbcccheckdb-output-with-o-errors-1024x480.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/dbcccheckdb-output-with-o-errors-300x141.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/dbcccheckdb-output-with-o-errors-768x360.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/dbcccheckdb-output-with-o-errors.png 1303w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>If consistency errors found by the command, means data corruption is detected. It also recommend the repair option to resolve the detected error as shown in fig:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1023\" height=\"683\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/dbcccheckdb-output-with-errors.png\" alt=\"DBCC CHECKDB Output  With Errors\" class=\"wp-image-191416 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/dbcccheckdb-output-with-errors.png 1023w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/dbcccheckdb-output-with-errors-300x200.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/dbcccheckdb-output-with-errors-768x513.png 768w\" sizes=\"auto, (max-width: 1023px) 100vw, 1023px\" \/><\/figure><h2 class=\"wp-block-heading\" id=\"causes-behind-sql-server-database-consistency-errors\"><strong>Causes behind SQL Server Database Consistency Errors<\/strong><\/h2><p>DBCC CHECKDB check fails or report consistency errors due to various reasons, such as issues in the hardware system or SQL Server Engine, file system corruption, or corrupted pages in memory.<\/p><p>Before attempting to resolve the db inconsistency problem, it is important first to understand why database consistency errors have occurred.<\/p><h2 class=\"wp-block-heading\" id=\"how-to-determine-the-causes-behind-consistency-errors-in-sql-server-database?\"><strong>How to Determine the Causes behind Consistency Errors in SQL Server Database?<\/strong><\/h2><p>To find out what has caused database consistency errors, consider this table:<\/p><figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"694\" height=\"452\" data-id=\"191509\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/SQL-Server-Consistency-Errors_-Cause-Identification_-2.png\" alt=\"SQL Server Consistency Errors: Cause Identification\" class=\"wp-image-191509 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/SQL-Server-Consistency-Errors_-Cause-Identification_-2.png 694w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/SQL-Server-Consistency-Errors_-Cause-Identification_-2-300x195.png 300w\" sizes=\"auto, (max-width: 694px) 100vw, 694px\" \/><\/figure>\n<\/figure><h2 class=\"wp-block-heading\" id=\"steps-to-repair-sql-database-using-the-dbcc-checkdb-command\"><strong>Steps to Repair SQL Database using the DBCC CHECKDB Command<\/strong><\/h2><p>Open the SQL Server Management Studio (SSMS) and follow these steps:<\/p><blockquote class=\"note_alert\">\n<p><strong>Test Environment (all steps verified on this configuration)<\/strong> <strong>Operating System: Microsoft Windows 11 Pro (x64)<\/strong> <strong>SQL Server: 2022 (version 16.0.1000.6, Developer Edition)<\/strong> <strong>SQL Server Management Studio (SSMS): 20.2.1<\/strong> <strong>RAM: 32 GB&nbsp; |&nbsp; Processor: 13th Gen Intel Core i5-1335U&nbsp; |&nbsp; Storage: 500 GB SSD<\/strong> <strong>Note: All commands in this guide apply equally to SQL Server 2016, 2017, 2019, 2022, and 2025.<\/strong><\/p>\n<\/blockquote><h3 class=\"wp-block-heading\"><strong>Step 1: Set Database to Emergency Mode<\/strong><\/h3><p>If the database is inaccessible or it is in suspect mode, first change its status to EMERGENCY mode. This will provide read-only access to the administrator. To put the <a href=\"https:\/\/www.stellarinfo.com\/blog\/recover-sql-database-from-emergency-mode-to-normal-mode\/\">database in EMERGENCY mode<\/a>, run the following query in SSMS:<\/p><pre class=\"wp-block-code command_container\"><code><code>ALTER DATABASE [3.Bonus2] SET EMERGENCY<\/code><\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"580\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-state-of-SQL-database-as-emergency-mode-1024x580.png\" alt=\"Set Database to Emergency Mode\" class=\"wp-image-191418 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-state-of-SQL-database-as-emergency-mode-1024x580.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-state-of-SQL-database-as-emergency-mode-300x170.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-state-of-SQL-database-as-emergency-mode-768x435.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-state-of-SQL-database-as-emergency-mode.png 1043w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><h3 class=\"wp-block-heading\"><strong>Step 2: Check Database for Corruption Errors<\/strong><\/h3><p>After setting the database to EMERGENCY mode, execute the following command to check the database for corruption errors:<\/p><pre class=\"wp-block-code command_container\"><code><code>DBCC CHECKDB ( [3.Bonus2])<\/code><\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"593\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-database-with-dbcccheckdb-before-repair-1024x593.png\" alt=\"Checking SQL Database  Using DBCC CHECKD After Repair\" class=\"wp-image-191419 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-database-with-dbcccheckdb-before-repair-1024x593.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-database-with-dbcccheckdb-before-repair-300x174.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-database-with-dbcccheckdb-before-repair-768x445.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-database-with-dbcccheckdb-before-repair.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>If the DBCC CHECKDB command detects any errors or corruption in the database, it will recommend an appropriate repair option.<\/p><h3 class=\"wp-block-heading\"><strong>Step 3: Set Database to SINGLE_USER Mode<\/strong><\/h3><p>Before using the repair option, you need to put the database in <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/databases\/set-a-database-to-single-user-mode?view=sql-server-ver17\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">SINGLE_USER mode <\/a>&nbsp;to prevent other users from modifying the data during the repair process. Also, Make sure you have the ALTER permission on the database.<\/p><p>To set the database to SINGLE_USER mode, run the following T-SQL query in SSMS:<\/p><pre class=\"wp-block-code command_container\"><code><code>ALTER DATABASE [3.Bonus2]&nbsp; SET SINGLE_USER<\/code><\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"568\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/fail-to-recover-SQL-database-from-emergency-mode-issue-1024x568.png\" alt=\"Fail to Set Database to SINGLE_USER Mode Its Stuck in Emergency Mode\" class=\"wp-image-191420 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/fail-to-recover-SQL-database-from-emergency-mode-issue-1024x568.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/fail-to-recover-SQL-database-from-emergency-mode-issue-300x166.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/fail-to-recover-SQL-database-from-emergency-mode-issue-768x426.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/fail-to-recover-SQL-database-from-emergency-mode-issue.png 1222w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>Sometimes, you may encounter a situation where you&rsquo;re not able to <a href=\"https:\/\/www.stellarinfo.com\/blog\/recover-sql-database-from-emergency-mode-to-normal-mode\/\" target=\"_blank\" rel=\"noreferrer noopener\">recover SQL Database from Emergency Mode to Normal Mode<\/a>. In such a case, first check the state of your database by following command<\/p><pre class=\"wp-block-code command_container\"><code><code>SELECT name, state_descFROM sys.databasesWHERE name = '3.Bonus2';<\/code><\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"580\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-state-of-SQL-database-as-emergency-mode-1-1024x580.png\" alt=\"Checking State Of SQL Database\" class=\"wp-image-191421 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-state-of-SQL-database-as-emergency-mode-1-1024x580.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-state-of-SQL-database-as-emergency-mode-1-300x170.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-state-of-SQL-database-as-emergency-mode-1-768x435.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/checking-state-of-SQL-database-as-emergency-mode-1.png 1043w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p><strong>If it shows EMERGENCY then you can try the following command:<\/strong><\/p><pre class=\"wp-block-code command_container\"><code><code>ALTER DATABASE&nbsp; [3.Bonus2] SET ONLINE<\/code><\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"612\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/changing-SQL-database-state-to-online-1024x612.png\" alt=\"Changing SQL Database State To Online\" class=\"wp-image-191422 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/changing-SQL-database-state-to-online-1024x612.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/changing-SQL-database-state-to-online-300x179.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/changing-SQL-database-state-to-online-768x459.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/changing-SQL-database-state-to-online.png 1132w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>Now again try to change the database state to SINGLE_USER<\/p><p><strong>Step 4: Rebuild SQL Database with REPAIR<\/strong><\/p><p>After setting the database to SINGLE_USER mode, run the command with the REPAIR option recommended by DBCC CHECKDB command.&nbsp;If it shows an error message recommending to run the REPAIR_REBUILD as the minimum repair level, then run the DBCC CHECKDB command with REPAIR_REBUILD option as given below:<\/p><blockquote class=\"note_alert\">\n<p><strong>Note:<\/strong> Before running any repair option, take a full database backup with BACKUP DATABASE. If the repair goes wrong &mdash; or introduces a logical inconsistency that only shows up later &mdash; you will want that backup. <\/p>\n\n\n\n<p><strong>Source<\/strong>: <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/backup-restore\/back-up-and-restore-of-sql-server-databases?view=sql-server-ver17\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Microsoft SQL Server Documentation &mdash; Back Up and Restore of SQL Server Databases<\/a><\/p>\n<\/blockquote><pre class=\"wp-block-code command_container\"><code><code>DBCC CHECKDB ([3.Bonus2], REPAIR_REBUILD);GO<\/code><\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"526\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-repair-rebuild-command-to-repair-SQL-database-1024x526.png\" alt=\"Running DBCC CHECKDB  Repair Rebuild Command to Repair SQL Database \" class=\"wp-image-191423 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-repair-rebuild-command-to-repair-SQL-database-1024x526.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-repair-rebuild-command-to-repair-SQL-database-300x154.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-repair-rebuild-command-to-repair-SQL-database-768x395.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcc-checkdb-repair-rebuild-command-to-repair-SQL-database.png 1169w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>This command will rebuild the database without any data loss. It can repair missing rows in non-clustered indexes and help in fixing minor corruption errors. However, it is a time-consuming option.<\/p><p>Alternatively, you can use the REPAIR_FAST with the command as given below:<\/p><pre class=\"wp-block-code command_container\"><code>DBCC CHECKDB ([3.Bonus2], REPAIR_FAST);\nGO<\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"471\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcccheckdb-command-with-repair-fast-command-1024x471.png\" alt=\"Running DBCC CHECKDB Command with Repair-Fast Command\" class=\"wp-image-191424 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcccheckdb-command-with-repair-fast-command-1024x471.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcccheckdb-command-with-repair-fast-command-300x138.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcccheckdb-command-with-repair-fast-command-768x353.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-dbcccheckdb-command-with-repair-fast-command.png 1210w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>This repair option only maintains backward compatibility syntax and does not perform any repair actions.<\/p><p>If the above repair options fail or the DBCC CHECKDB command recommended using the <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/database-console-commands\/dbcc-checkdb-transact-sql?view=sql-server-ver17\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">REPAIR_ALLOW_DATA_LOSS<\/a> repair option, then run it as given below:<\/p><pre class=\"wp-block-code command_container\"><code>DBCC CHECKDB ([3.Bonus2], REPAIR_ALLOW_DATA_LOSS)\n<code>WITH ALL_ERRORMSGS, NO_INFOMSGS;<\/code>GO<\/code><\/pre><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"600\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-DBCCCHECKDB-repair-allow-data-loss-command-with-output-1024x600.png\" alt=\"Running DBCCCHECKDB REPAIR ALLOW DATA LOSS Command With Output\" class=\"wp-image-191425 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-DBCCCHECKDB-repair-allow-data-loss-command-with-output-1024x600.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-DBCCCHECKDB-repair-allow-data-loss-command-with-output-300x176.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-DBCCCHECKDB-repair-allow-data-loss-command-with-output-768x450.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/running-DBCCCHECKDB-repair-allow-data-loss-command-with-output.png 1146w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>The REPAIR_ALLOW_DATA_LOSS option helps in repairing all reported errors in the SQL server database but as per official of Microsoft, it causes data loss. In fact, Microsoft recommends using the REPAIR_ALLOW_DATA_LOSS option as a last resort.<\/p><blockquote class=\"note_alert\">\n<p><strong>Source:<\/strong> <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/database-console-commands\/dbcc-checkdb-transact-sql?view=sql-server-ver17\" type=\"link\" id=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/database-console-commands\/dbcc-checkdb-transact-sql?view=sql-server-ver17\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">MS SQL Guide dbcc checkdb<\/a><\/p>\n<\/blockquote><p>Sometimes, while executing this command to repair corrupt SQL database, you may encounter errors. One such error is <a href=\"https:\/\/www.stellarinfo.com\/article\/sql-error-945.php\">SQL error 945<\/a>.<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"811\" height=\"436\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/getting-sql-error-945-running-dbcccheckdb-command.png\" alt=\"Getting SQL Error 945 Running DBCC CHECKDB command\" class=\"wp-image-191426 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/getting-sql-error-945-running-dbcccheckdb-command.png 811w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/getting-sql-error-945-running-dbcccheckdb-command-300x161.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/getting-sql-error-945-running-dbcccheckdb-command-768x413.png 768w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/figure><h3 class=\"wp-block-heading\"><strong>Step 5: Set Database to MULTI_USER Mode<\/strong><\/h3><p>After successfully repairing the database, set the database to MULTI_USER mode by executing the following command:<\/p><pre class=\"wp-block-code command_container\"><code><code>ALTER DATABASE [3.Bonus2] SET MULTI_USER;<\/code>GO<\/code><\/pre><h2 class=\"wp-block-heading\" id=\"running-dbcc-checkdb-in-always-on-availability-groups:\">Running DBCC CHECKDB in Always On Availability Groups:<\/h2><p>If database is a part of Availability Group, you can run DBCC CHECKDB on readable secondary replicas instead of primary one. This is one of the most practical benefits of AGs for database integrity checks. Here are some points you need to know:<\/p><ul class=\"wp-block-list\">\n<li><strong>Run CHECKDB on the secondary<\/strong>:<\/li>\n<\/ul><p>Running DBCC CHECKDB command on a large database can cause load on the primary server. You can run this command on a database in Always on Availability Groups on a readable secondary replicas instead of primary one. This helps you to check the results on the secondary server without slowing down the primary server.<\/p><ul class=\"wp-block-list\">\n<li><strong>Manage corruption on the primary<\/strong>:<\/li>\n<\/ul><p>If you find any corruption issues then you need to failover and run the repair on primary server to resolve them.<\/p><ul class=\"wp-block-list\">\n<li><strong>Schedule during off-peak hours<\/strong>:<\/li>\n<\/ul><p>For less performance impact, it is recommended to schedule DBCC CHECKDB on secondary during off-peak hours.<\/p><ul class=\"wp-block-list\">\n<li><strong>Understand its repair limitations on AGs<\/strong><\/li>\n<\/ul><p>The DBCC CHECKDB command does not support repairing severely corrupted pages and meta data.&nbsp; If running its repair option, can cause data loss and synchronization issues. So it&rsquo;s highly recommended to take a backup before using it.<\/p><blockquote class=\"note_alert\">\n<p><em><strong>Source<\/strong>: <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/database-engine\/availability-groups\/windows\/overview-of-always-on-availability-groups-sql-server?view=sql-server-ver17\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Microsoft Always On Availability Groups &mdash; Run DBCC CHECKDB on a Secondary Replica<\/a> <\/em><\/p>\n<\/blockquote><h2 class=\"wp-block-heading\" id=\"limitations-and-downsides-of-dbcc-checkdb-command\">Limitations and Downsides of DBCC CHECKDB Command<\/h2><p>Though DBCC CHECKDB can fix consistency issues, using the REPAIR_ALLOW_DATA_LOSS option comes with serious downsides. Every experienced DBA has run into these limitations at some point.<\/p><figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Limitation<\/strong><\/td><td><strong>Mitigation<\/strong><\/td><\/tr><tr><td>It may deallocate rows or pages when repairing the database. Deallocated data can sometimes become unrecoverable. &nbsp;<\/td><td>Always take a BACKUP DATABASE before running any repair.<\/td><\/tr><tr><td>It may leave your database in a logically inconsistent state. &nbsp;<\/td><td>After any repair, run DBCC CHECKCATALOG to check system catalog consistency. Next, run the DBCC CHECKCONSTRAINTS to check foreign key relationships manually.<\/td><\/tr><tr><td>You may require to use this command multiple times to fix all errors associated with SQL database. It is a time-consuming process. &nbsp;<\/td><td>Run DBCC CHECKDB Use PHYSICAL_ONLY first to identify scope before full repair.<\/td><\/tr><tr><td>It does not guarantee complete SQL Server database recovery. &nbsp;<\/td><td>In this case, put the database in EMERGENCY mode, use page-level restore or use Stellar Repair for MS SQL to repair database with complete integrity<\/td><\/tr><\/tbody><\/table><\/figure><h2 class=\"wp-block-heading\" id=\"an-alternative-to&nbsp;dbcc-checkdb-command:-stellar-repair-for-ms-sql\">An Alternative to&nbsp;DBCC CHECKDB Command: Stellar Repair for MS SQL<\/h2><p>There are failure scenarios that DBCC CHECKDB simply cannot handle &mdash; particularly when corruption has hit the allocation pages, the system tables themselves, or the database header. In those situations, even putting the database into EMERGENCY mode fails.<\/p><p>This is where a specialized third-party software comes into picture. You can use Stellar Repair for MS SQL, developed by Stellar Information Technology to repair the corrupt SQL database with complete integrity. It is trusted and recommended by MVPs. It repairs severely corrupt MS SQL database and restores all its components. The&nbsp;<a href=\"https:\/\/www.stellarinfo.com\/sql-database-repair.php\">SQL database repair software&nbsp;<\/a>helps reinstate access to the database with minimal manual efforts and time.<\/p><h3 class=\"wp-block-heading\"><strong>Key Features of Stellar Repair for MS SQL:<\/strong><\/h3><ul class=\"wp-block-list\">\n<li>Repairs both MDF and NDF database files<\/li>\n\n\n\n<li>Recovers all database components, including tables, keys, indexes, <a href=\"https:\/\/www.stellarinfo.com\/blog\/repair-sql-database-stored-procedures\/\">stored procedures in MS SQL<\/a>, etc.<\/li>\n\n\n\n<li>Allows&nbsp;<a href=\"https:\/\/www.stellarinfo.com\/support\/kb\/index.php\/article\/recover-sql-deleted-records\" target=\"_blank\" rel=\"noreferrer noopener\">recovery of deleted records<\/a><\/li>\n\n\n\n<li>Recovers SQL tables with PAGE and ROW compression<\/li>\n\n\n\n<li>Generates preview of recoverable database objects before saving<\/li>\n\n\n\n<li>Saves the repaired database to a new or live database and formats like CSV, HTML, and XLS<\/li>\n\n\n\n<li>Supports SQL Server database 2025, 2022, 2019, 2017, 2016, 2014, 2012, and lower versions<\/li>\n\n\n\n<li>Compatible with both Windows 11, 10, 8.1, 8 &amp; Windows server 2022, 2019, 2016, 2012 and Linux operating systems<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"how-to-use-stellar-repair-for-ms-sql-when-dbcc-checkdb-fails?\">How to Use Stellar Repair for MS SQL when DBCC CHECKDB fails?<\/h2><p><strong>Step 1<\/strong>. Download, install and launch Stellar Repair for MSSQL<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/cloud.stellarinfo.com\/StellarRepairforMSSQL-B.exe\"><img loading=\"lazy\" decoding=\"async\" width=\"252\" height=\"80\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/free-download-windows.png\" alt=\"Free Download for Windows\" class=\"wp-image-191494 apply-gradient-on-post-images\"><\/a><\/figure>\n<\/div><p><strong>Step 2<\/strong>. Click Browse to select the corrupt MDF database file. Click <strong>Repair<\/strong>.<\/p><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"523\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/clicking-repair-option-in-Stellar-repair-for-mssql-1024x523.png\" alt=\"Clicking Repair Option In Stellar Repair for MS SQL\" class=\"wp-image-191427 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/clicking-repair-option-in-Stellar-repair-for-mssql-1024x523.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/clicking-repair-option-in-Stellar-repair-for-mssql-300x153.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/clicking-repair-option-in-Stellar-repair-for-mssql-768x392.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/clicking-repair-option-in-Stellar-repair-for-mssql.png 1260w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p><strong>Step 3<\/strong>. Select <strong>Standard<\/strong> Scan. Click <strong>OK<\/strong>.<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"514\" height=\"218\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/selecting-scan-mode-of-Stellarrepairformssql.png\" alt=\"Selecting Scan Mode in Stellar Repair for MSSQL\" class=\"wp-image-191428 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/selecting-scan-mode-of-Stellarrepairformssql.png 514w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/selecting-scan-mode-of-Stellarrepairformssql-300x127.png 300w\" sizes=\"auto, (max-width: 514px) 100vw, 514px\" \/><\/figure><p><strong>Step 4<\/strong>. The tool will start repairing the selected database file (3.Bonus2.mdf)<\/p><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"600\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/selected-database-repaired-successfully-message-1024x600.png\" alt=\"Selected Database Repaired Successfully Message\" class=\"wp-image-191429 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/selected-database-repaired-successfully-message-1024x600.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/selected-database-repaired-successfully-message-300x176.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/selected-database-repaired-successfully-message-768x450.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/selected-database-repaired-successfully-message.png 1157w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p><strong>Step 5<\/strong>. Once repair process completes, you will &ldquo;<strong>Selected MS SQL database repaired successfully<\/strong>&rdquo; message. Click OK.<\/p><p>To walk through Stellar Repair for MS SQL, watch this video<\/p><figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Troubleshooting Corrupt Database with DBCC CHECKDB - Solving Msg 824 logical consistency I\/O error\" width=\"750\" height=\"422\" src=\"https:\/\/www.youtube.com\/embed\/czXGeS3EZG8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure><h2 class=\"wp-block-heading\" id=\"tested-and-approved-by-microsoft-most-valuable-professional\"><strong>Tested and Approved by Microsoft Most Valuable Professional<\/strong><\/h2><blockquote class=\"note_alert\">\n<p><em>Stellar Repair for MS SQL delivers proven recovery in critical production failures. <\/em><a href=\"https:\/\/www.linkedin.com\/posts\/anton-martyniuk_my-ms-sql-server-database-got-corrupted-activity-7379402330997149696-Wefv\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\"><em>As Anton Martyniuk shared<\/em><\/a><em>, this tool helped him repair a corrupt SQL database when DBCC CHECKDB, backups, and emergency mode all failed. In another case study, it enabled SAPIENCE SIS INDIA PVT LTD to recover a <\/em><a href=\"https:\/\/www.stellarinfo.com\/casestudy\/sapience-sis-india.php\" target=\"_blank\" rel=\"noreferrer noopener\"><em>corrupt database after an unexpected hard disk failure<\/em><\/a><em>.&nbsp;<\/em><\/p>\n<\/blockquote><h2 class=\"wp-block-heading\" id=\"dbcc-checkdb-performance-&amp;-optimization-&amp;-best-practices\">DBCC CHECKDB Performance &amp; Optimization &amp; Best Practices<\/h2><p>THE DBCC CHECKDB command uses a lot of CPU, I\/O, and TempDB to execute smoothly. So it is required to optimize its performance, to minimize downtime. To do so, you should use appropriate options, such as MAXDOP settings and WITH PHYSICAL_ONLY for large databases. And schedule running it during off-peak hours, and keep tracking the command execution times from SQL server error logs.<\/p><h3 class=\"wp-block-heading\"><strong>Best Practices to optimize DBCC CHECKDB usage<\/strong><\/h3><p><strong>1. Use Trace Flags 2562 and 2549<\/strong><\/p><p>Microsoft recommends using the <a href=\"https:\/\/support.microsoft.com\/en-us\/topic\/kb2634571-improvements-for-the-dbcc-checkdb-command-may-result-in-faster-performance-when-you-use-the-physical-only-option-e49ca6f4-8a5a-7a09-40d3-266ca513177f\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">2562 and 2549 trace flags<\/a> to improve disk I\/O resource usage while executing the&nbsp;DBCC CHECKDB&nbsp;command with the&nbsp;PHYSICAL_ONLY&nbsp;option.<\/p><p><strong>Trace flag 2562<\/strong>: It optimizes DBCC CHCKDB performance by running the command as a single batch. Further, it helps determine the pages to be read from a database. However, one problem associated with this trace flag is that it may increase the utilization of tempdb (i.e., 5 percent of the database size).<\/p><p><strong>Trace flag 2549:&nbsp;<\/strong>Using this trace flag helps improve performance of the DBCC CHECKDB&nbsp;command. It does so by assuming that each database file resides on a unique underlying disk. Do not use this trace flag for the database that has multiple data files.<\/p><p><strong>2. Optimize TempDB<\/strong><\/p><p>DBCC CHECKDB can make heavy usage of temporary database (TempDB). To properly utilize it, put TempDB on a fast I\/O subsystem. Essentially, put the TempDB database on its own set of fast disks or spindles.<\/p><p><strong>3. Cut Down on CPU Usage<\/strong><\/p><p>If you can run DBCC CHECKDB for a longer duration to limit CPU usage, try reducing parallelism by following these practices:<\/p><p>Turn off parallelism for DBCC CHECKDB (and its commands CHECKFILEGROUP and CHECKTABLE) by using trace flag 2528.<\/p><p>Use the SQL Server&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/sql\/sql-server-2008-r2\/ms181007(v=sql.105)?redirectedfrom=MSDN\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">maximum degree of parallelism<\/a>&nbsp;option to limit the number of processors to be used for parallel queries.<\/p><p><strong>4. Run weekly<\/strong><\/p><p>You can run DBCC CHECKDB command weekly to catch corruption early before it causes further data loss or spreads. You can try to schedule it during weekends or off-hours to reduce performance impacts.&nbsp;<\/p><p><strong>5. Run the command after Backup restore<\/strong><\/p><p>Always prefer running DBCC CHECKDB command after restore. This helps you confirm that your restored database is consistent.<\/p><h2 class=\"wp-block-heading\" id=\"dbcc-checkdb-vs-other-dbcc-commands&nbsp;\">DBCC CHECKDB vs Other DBCC Commands&nbsp;<\/h2><figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Command<\/strong><\/td><td><strong>Scope<\/strong><\/td><td><strong>When to use instead of CHECKDB<\/strong><\/td><\/tr><tr><td><strong>DBCC CHECKDB<\/strong><\/td><td>Entire database<\/td><td>Full integrity validation &mdash; run this weekly or whenever you suspect corruption.<\/td><\/tr><tr><td><strong>DBCC CHECKTABLE<\/strong><\/td><td>Single table<\/td><td>When CHECKDB is impractical on a very large database and you need to focus on a specific table that is generating errors. Checks indexes and row structure for that table only.<\/td><\/tr><tr><td><strong>DBCC CHECKALLOC<\/strong><\/td><td>Allocation pages only (GAM, SGAM, PFS, IAM)<\/td><td>When you specifically suspect allocation-level corruption &mdash; double-allocated extents, unlinked pages, or suspect_pages table entries pointing to IAM pages.<\/td><\/tr><tr><td><strong>DBCC CHECKCATALOG<\/strong><\/td><td>System catalog consistency<\/td><td>After a DBCC CHECKDB repair, run DBCC CHECKCATALOG to verify the system catalog is consistent &mdash; CHECKDB does not check inter-catalog relationships.<\/td><\/tr><\/tbody><\/table><\/figure><h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2><p>If your SQL database is corrupted, you can use the DBCC CHECKDB command to check and repair it. Above, we have explained how to use the DBCC CHECKDB command to repair SQL database. However, using the DBCC CHECKDB command with REPAIR_ALLOW_DATA_LOSS involves risk of data loss. To repair the corrupt database without data loss, you can use Stellar Repair for MS SQL. The software helps retrieve all the SQL database components, including tables, <a href=\"https:\/\/www.stellarinfo.com\/blog\/recover-deleted-records-in-sql-server\/\">deleted table records<\/a>, indexes, views, etc. You can free download the software to evaluate its functionality and efficiency.<\/p><p><a id=\"_msocom_4\"><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>DBCC CHECKDB is a built-in command in Microsoft SQL server used to&hellip; <a class=\"more-link\" href=\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/\">Continue reading <span class=\"screen-reader-text\">How to Repair SQL Database using DBCC CHECKDB Command?<\/span><\/a><\/p>\n","protected":false},"author":82,"featured_media":171729,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-48632","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-recovery","entry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Repair SQL Database Using DBCC CHECKDB Command - Complete Guide<\/title>\n<meta name=\"description\" content=\"Repair Corrupt SQL Database using DBCC CHECKDB Command - Set Database to Emergency Mode, SINGLE_USER Mode, MULTI_USER Mode and use SQL repair tool if DBCC CHECKDB fails.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Repair SQL Database Using DBCC CHECKDB Command - Complete Guide\" \/>\n<meta property=\"og:description\" content=\"Repair Corrupt SQL Database using DBCC CHECKDB Command - Set Database to Emergency Mode, SINGLE_USER Mode, MULTI_USER Mode and use SQL repair tool if DBCC CHECKDB fails.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/\" \/>\n<meta property=\"og:site_name\" content=\"Stellar Data Recovery Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-07T06:24:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-24T12:00:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/repair-MS-SQL-Database-using-DBCC-CHECKDB-Command.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Monika Dadool\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Monika Dadool\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"18 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/\"},\"author\":{\"name\":\"Monika Dadool\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd\"},\"headline\":\"How to Repair SQL Database using DBCC CHECKDB Command?\",\"datePublished\":\"2020-01-07T06:24:43+00:00\",\"dateModified\":\"2026-04-24T12:00:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/\"},\"wordCount\":3401,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/repair-MS-SQL-Database-using-DBCC-CHECKDB-Command.jpg\",\"articleSection\":[\"SQL Database Repair\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/\",\"name\":\"How to Repair SQL Database Using DBCC CHECKDB Command - Complete Guide\",\"isPartOf\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/repair-MS-SQL-Database-using-DBCC-CHECKDB-Command.jpg\",\"datePublished\":\"2020-01-07T06:24:43+00:00\",\"dateModified\":\"2026-04-24T12:00:45+00:00\",\"author\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd\"},\"description\":\"Repair Corrupt SQL Database using DBCC CHECKDB Command - Set Database to Emergency Mode, SINGLE_USER Mode, MULTI_USER Mode and use SQL repair tool if DBCC CHECKDB fails.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#primaryimage\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/repair-MS-SQL-Database-using-DBCC-CHECKDB-Command.jpg\",\"contentUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/repair-MS-SQL-Database-using-DBCC-CHECKDB-Command.jpg\",\"width\":1000,\"height\":600,\"caption\":\"Repair MS SQL Database using DBCC CHECKDB Command\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.stellarinfo.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Repair SQL Database using DBCC CHECKDB Command?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#website\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/\",\"name\":\"Stellar Data Recovery Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.stellarinfo.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd\",\"name\":\"Monika Dadool\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g\",\"caption\":\"Monika Dadool\"},\"description\":\"Monika Dadool is a Senior Content Writer at Stellar with over 5 years of experience in technical writing. She is a tech enthusiast and expert who specializes in writing about SQL Server, MySQL Server, MariaDB Server, Microsoft Access, Active Directory, email recovery, Microsoft 365, pattern recognition, machine learning, data recovery, file repair, and operating systems like Linux, Windows, and Mac. She also writes about accounting software such as QuickBooks and Sage 50, as well as web-scripting languages like HTML, JavaScript, Python, PHP, Visual Basic, ASP.NET, and AJAX. Monika is passionate about researching and exploring new technologies, and she enjoys developing engaging technical blogs that help organizations and database administrators resolve various issues. When she's not creating content, you can find her on social media, watching web series, reading books, or exploring new food recipes.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/monika-dadool-105a87163\/\"],\"url\":\"https:\/\/www.stellarinfo.com\/blog\/author\/monika\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Repair SQL Database Using DBCC CHECKDB Command - Complete Guide","description":"Repair Corrupt SQL Database using DBCC CHECKDB Command - Set Database to Emergency Mode, SINGLE_USER Mode, MULTI_USER Mode and use SQL repair tool if DBCC CHECKDB fails.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/","og_locale":"en_US","og_type":"article","og_title":"How to Repair SQL Database Using DBCC CHECKDB Command - Complete Guide","og_description":"Repair Corrupt SQL Database using DBCC CHECKDB Command - Set Database to Emergency Mode, SINGLE_USER Mode, MULTI_USER Mode and use SQL repair tool if DBCC CHECKDB fails.","og_url":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/","og_site_name":"Stellar Data Recovery Blog","article_published_time":"2020-01-07T06:24:43+00:00","article_modified_time":"2026-04-24T12:00:45+00:00","og_image":[{"width":1000,"height":600,"url":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/repair-MS-SQL-Database-using-DBCC-CHECKDB-Command.jpg","type":"image\/jpeg"}],"author":"Monika Dadool","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Monika Dadool","Est. reading time":"18 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#article","isPartOf":{"@id":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/"},"author":{"name":"Monika Dadool","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd"},"headline":"How to Repair SQL Database using DBCC CHECKDB Command?","datePublished":"2020-01-07T06:24:43+00:00","dateModified":"2026-04-24T12:00:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/"},"wordCount":3401,"commentCount":0,"image":{"@id":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#primaryimage"},"thumbnailUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/repair-MS-SQL-Database-using-DBCC-CHECKDB-Command.jpg","articleSection":["SQL Database Repair"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/","url":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/","name":"How to Repair SQL Database Using DBCC CHECKDB Command - Complete Guide","isPartOf":{"@id":"https:\/\/www.stellarinfo.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#primaryimage"},"image":{"@id":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#primaryimage"},"thumbnailUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/repair-MS-SQL-Database-using-DBCC-CHECKDB-Command.jpg","datePublished":"2020-01-07T06:24:43+00:00","dateModified":"2026-04-24T12:00:45+00:00","author":{"@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd"},"description":"Repair Corrupt SQL Database using DBCC CHECKDB Command - Set Database to Emergency Mode, SINGLE_USER Mode, MULTI_USER Mode and use SQL repair tool if DBCC CHECKDB fails.","breadcrumb":{"@id":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#primaryimage","url":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/repair-MS-SQL-Database-using-DBCC-CHECKDB-Command.jpg","contentUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2020\/01\/repair-MS-SQL-Database-using-DBCC-CHECKDB-Command.jpg","width":1000,"height":600,"caption":"Repair MS SQL Database using DBCC CHECKDB Command"},{"@type":"BreadcrumbList","@id":"https:\/\/www.stellarinfo.com\/blog\/how-to-repair-sql-database-using-dbcc-checkdb-command\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.stellarinfo.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Repair SQL Database using DBCC CHECKDB Command?"}]},{"@type":"WebSite","@id":"https:\/\/www.stellarinfo.com\/blog\/#website","url":"https:\/\/www.stellarinfo.com\/blog\/","name":"Stellar Data Recovery Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.stellarinfo.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd","name":"Monika Dadool","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g","caption":"Monika Dadool"},"description":"Monika Dadool is a Senior Content Writer at Stellar with over 5 years of experience in technical writing. She is a tech enthusiast and expert who specializes in writing about SQL Server, MySQL Server, MariaDB Server, Microsoft Access, Active Directory, email recovery, Microsoft 365, pattern recognition, machine learning, data recovery, file repair, and operating systems like Linux, Windows, and Mac. She also writes about accounting software such as QuickBooks and Sage 50, as well as web-scripting languages like HTML, JavaScript, Python, PHP, Visual Basic, ASP.NET, and AJAX. Monika is passionate about researching and exploring new technologies, and she enjoys developing engaging technical blogs that help organizations and database administrators resolve various issues. When she's not creating content, you can find her on social media, watching web series, reading books, or exploring new food recipes.","sameAs":["https:\/\/www.linkedin.com\/in\/monika-dadool-105a87163\/"],"url":"https:\/\/www.stellarinfo.com\/blog\/author\/monika\/"}]}},"_links":{"self":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/48632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/users\/82"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/comments?post=48632"}],"version-history":[{"count":94,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/48632\/revisions"}],"predecessor-version":[{"id":191521,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/48632\/revisions\/191521"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/media\/171729"}],"wp:attachment":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/media?parent=48632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/categories?post=48632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/tags?post=48632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}