Problem Statement
I just ran dbcc checkdb on the sample WideWorldImporters database. I received (4) errors about statistics corruption that I do not remember having seen in the past when I ran this command. Although this is a sample database only, I am curious as I'd hate to see a similar error in a real database.
SSMS and Windows Versions
SSMS: 18.10 (15.0.18390.0) / Windows 10: Version 21H1 (OS Build 19043.1526)
SQL Server Developer Version
Microsoft SQL Server 2019 (RTM-CU13) (KB5005679) - 15.0.4178.1 (X64) Sep 23 2021 16:47:49 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Pro 10.0 (Build 19043: )
Command Issued in SSMS:
dbcc checkdb ([WideWorldImporters]) with all_errormsgs, data_purity, extended_logical_checks , no_infomsgs;
go
Error Messages
Msg 9122, Level 16, State 201, Line 10
The statistics 'sys.TT_OrderIDList_22AA2996.PK__TT_Order__C3905BAE80B57D6F' is corrupt.
Msg 9122, Level 16, State 201, Line 10
The statistics 'sys.TT_OrderLineList_24927208.IX_Website_OrderLineList' is corrupt.
Msg 9122, Level 16, State 201, Line 10
The statistics 'sys.TT_OrderList_25869641.PK__TT_Order__288FD689F5006DE2' is corrupt.
Msg 9122, Level 16, State 201, Line 10
The statistics 'sys.TT_SensorDataList_276EDEB3.PK__TT_Senso__88385F3043E9E8D9' is corrupt.
CHECKDB found 0 allocation errors and 4 consistency errors in database 'WideWorldImporters'.
My attempts to fix
I quickly learned that I do not have the required privileges to delete sys.* indexes. I tried restoring the database from my last backup, but this produced the same exact error messages.
Next, I opened this web page to download a fresh copy:
https://github.com/Microsoft/sql-server-samples/releases/tag/wide-world-importers-v1.0
I downloaded "WideWorldImporters-Full.bak" (121 MB), cleared the "Mark of the Web" (MOTW) in properties, and successfully restored the database. However, upon running the same dbcc checkdb command shown above, I received the exact same errors!
Finally, I downloaded "WideWorldImporters-Full.bacpac" (59.1 MB), cleared the "Mark of the Web" (MOTW) in properties, and successfully restored the database. This also resulted in the same dbcc checkdb errors shown above.
I clearly do not remember ever having received these errors, which makes me wonder could there be an "issue" in my current version of Windows, SSMS or SQL Developer that is contributing to these errors?
Thank You