DEFINITIONS

Definitions More Info.
Definition ID995
TitleSQL
CategoryNOTES
Definitionstatistics linked server problem
Definition Descriptionhttps://jasonbrimhall.info/2017/10/17/linked-servers-and-stats/

--asagidaki istatistik adi yerine sorunlu olan istatistik ismini koy ve istatistik hangi tablo uzerinde ve AUTOCREATED stats ise drop et. Zaten ihtiyac varsa, sistem o istatisigi otomatik olusturur.

SELECT DB_NAME(),
so.name AS TableName,
ss.name AS StatisticsName,
N'DROP STATISTICS [' +ssc.name + ']' + '.[' + so.name + ']' +'.['+ss.name + '];'
FROM sys.stats AS ss
INNER JOIN sys.objects AS so ON ss.[object_id]=so.[object_id]
INNER JOIN sys.schemas AS ssc ON so.schema_id=ssc.schema_id
WHERE ss.auto_created=1
AND so.is_ms_shipped=0
--AND so.name='JobsDB'
AND ss.name='_WA_Sys_0000000D_762C88DA'

DROP STATISTICS ClientsDB.[_WA_Sys_0000000D_762C88DA]

ONEMLI : BAZEN YUKARIDAKI ISLEMI YAPSAKTA SIKINTI DEVAM EDEBILMEKTEDIR. BUNU COZMEK ICIN
https://learn.microsoft.com/en-us/answers/questions/692411/could-not-locate-statistics-error-when-reading-dat

Hi,

For the same problem, the only fix that worked for me was to create a new statistics for the column generating error, but this time with a filter condition for the column to exclude null values .

After this i've dropped the system stat on that column and on the secondary node, the statistics for this column was replicated with details as well (not only the metadata).

CREATE STATISTICS [stat_Column_Name] ON [dbo].[table]

WHERE ([Column_Name] IS NOT NULL)

GO

A second option to fix this problem was to rebuild all indexes of that table. After this operation the missing statistic was replicated imeadiatly on the secondary node, were was missing.

DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Msg 2767, Level 16, State 1, Procedure AtlantisDB.sys.sp_table_statistics2_rowset, Line 105 [Batch Start Line 0]
Could not locate statistics '_WA_Sys_0000000D_762C88DA' in the system catalogs.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
RecordBycunay
Record Date19-12-2019 11:32:21
Düzenle
Kopyala
Sil