SQL Server Consistency Check – How to Fix Database Consistency History Fails in SQL Server 2017 Express

sql serversql-server-2017sql-server-express

When I run the Database Consistency History report using MSSM I get an error message:

unable to retrieve data for this section of the report. Following
error occured Msg 19050, Level 16, State 5 Trace file name
'/var/opt/mmsql/log/log_86866.trc\log.trc' is invalid

I re ran DBBCC CHECKDB but it did not help.

When I run

SELECT tracefilename = path FROM sys.traces 
WHERE is_default = 1;

I get the tracefilename returned as

/var/opt/mssql/log/log_87148.trc

And if I re-run the Database Consistency History the tracefilename is now

'/var/opt/mmsql/log/log_87148.trc\log.trc' is invalid

Best Answer

This is a limitation in SSMS. This report does not properly support Linux, as the script is performing path manipulation using '\', which is the Windows path seperator.

This is a snippet of code run for that report:

select @curr_tracefilename = path from sys.traces where is_default = 1 ; 
set @curr_tracefilename = reverse(@curr_tracefilename); 
select @indx  = PATINDEX(''%\%'', @curr_tracefilename) ;  
set @curr_tracefilename = reverse(@curr_tracefilename); 
set @base_tracefilename = left( @curr_tracefilename,len(@curr_tracefilename) - @indx) + ''\log.trc'' ; 

You can post product feedback here.