|
| 1 | +--- |
| 2 | +title: Error 3853 When Using Incremental Statistics and Resumable Index Operations |
| 3 | +description: Resolves SQL Server error 3853 that occurs when you use incremental statistics and resumable index operations concurrently. |
| 4 | +ms.date: 04/03/2025 |
| 5 | +ms.custom: sap:File, Filegroup, Database Operations or Corruption |
| 6 | +ms.reviewer: rtownsend, jopilov, jaferebe, atsingh, ditikman |
| 7 | +--- |
| 8 | + |
| 9 | +# SQL Server error 3853 when using incremental statistics and resumable index operations concurrently |
| 10 | + |
| 11 | +_Applies to:_ SQL Server 2019, SQL Server 2017, SQL Server 2016 |
| 12 | + |
| 13 | +## Symptoms |
| 14 | + |
| 15 | +When you run a [DBCC CHECKDB](/sql/t-sql/database-console-commands/dbcc-checkdb-transact-sql) command, the following output might be generated: |
| 16 | + |
| 17 | +```output |
| 18 | +Corruption in database ID %I64d, object ID %Id possibly due to schema or catalog inconsistency. Run DBCC CHECKCATALOG. |
| 19 | +``` |
| 20 | + |
| 21 | +You might also see the following error message in the SQL Server error log: |
| 22 | + |
| 23 | +```output |
| 24 | +Attribute (%ls) of row (%ls) in sys.%ls%ls does not have a matching row (%ls) in sys.%ls%ls. |
| 25 | +Msg 3853, Level 16, State 1, Line 10 |
| 26 | +``` |
| 27 | + |
| 28 | +## Cause |
| 29 | + |
| 30 | +The 3853 error is caused by orphaned records in the `sys.syssingleobjrefs` system table. The `stats_id` in `sys.stats` remains as `2`, while the corresponding `stats_id` in `syssingleobjrefs` is `896002`, indicating a mismatch. The issue happens when all of the following conditions are met: |
| 31 | + |
| 32 | +- The source `object_id` is a partitioned table or index. |
| 33 | +- Incremental statistics are in use for a table or index. |
| 34 | +- Index creation or rebuild is performed using the `RESUMABLE` option. |
| 35 | +- Incremental statistics are updated, or the index is rebuilt using the `ONLINE = ON` option. |
| 36 | + |
| 37 | +## Status |
| 38 | + |
| 39 | +Microsoft has confirmed that this is a known issue in the versions of SQL Server listed in the "Applies to" section at the top of the article. Microsoft has also confirmed that the issue has been fixed in [Microsoft SQL Server 2022](https://www.microsoft.com/sql-server/sql-server-downloads). |
| 40 | + |
| 41 | +## Workaround |
| 42 | + |
| 43 | +To avoid this issue, don't use incremental statistics and resumable index operations on the same table or index simultaneously. |
| 44 | + |
| 45 | +## Resolution |
| 46 | + |
| 47 | +If the issue occurs, try the following options: |
| 48 | + |
| 49 | +- Restore the database from the most recent valid backup. |
| 50 | +- Create a new database and import the data from the corrupted database using the SQL Server Import and Export Wizard, Bulk Copy Program (BCP) utility, or manual export-import method. |
| 51 | +- Upgrade to SQL Server 2022, where the issue has been fixed. |
| 52 | +- Contact the Microsoft Customer Support team to request assistance with correcting the metadata. |
0 commit comments