0
votes

We have a tabular model cube that is refreshed each day via an SQL Agent job calling an SSAS Command. The command is simply:

{ "refresh": { "type": "full", "objects": [ { "database": "KPIDashboardv1" } ] } }

The job runs and succeeds each day. But I have noticed that some of the tables in the cube have not refreshed. select * from $system.TMSCHEMA_partitions shows these tables with a RefreshedTime of weeks ago.

How can I find what error or problem SSAS is having when attempting to process these tables?

I have tried:

  • Taking the Table Properties query from $system.TMSCHEMA_partitions and executing that query against the relevant Data Source. It succeeds promptly and contains up-to-date data.
  • Looked at the Output file configured for the SQL Agent job step. It is empty.
1

1 Answers

1
votes

Have you tried to check the data that XE collects? You needed "ProgressReportEnd" event

    <Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
  <ObjectDefinition>
    <Trace>
      <ID>ETLExecutionLogs</ID>
      <Name>ETLExecutionLogs</Name>
      <AutoRestart>true</AutoRestart>
      <XEvent xmlns="http://schemas.microsoft.com/analysisservices/2011/engine/300/300">
        <event_session name="ETLExecutionLogs" dispatchLatency="0" maxEventSize="0" maxMemory="4" memoryPartition="none" eventRetentionMode="AllowSingleEventLoss" trackCausality="true" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
          <event package="AS" name="ProgressReportEnd" />
          <target package="package0" name="event_file">
            <parameter name="filename" value="d:\YourServerLogPath\OLAP\Log\ETLExecutionLogs.xel" />
            <parameter name="max_file_size" value="250" />
            <parameter name="max_rollover_files" value="4" />
            <parameter name="increment" value="50" />
          </target>
        </event_session>
      </XEvent>
    </Trace>
  </ObjectDefinition>
</Create>

After that you can use powershell to extract info:

$SharedPath = "C:\Program Files\Microsoft SQL Server\150\Shared";


$xeCore = [System.IO.Path]::Combine($SharedPath, "Microsoft.SqlServer.XE.Core.dll");
$xeLinq = [System.IO.Path]::Combine($SharedPath, "Microsoft.SqlServer.XEvent.Linq.dll");
Add-Type -Path $xeLinq;

if( [System.IO.File]::Exists($xeCore) )
{
    Add-Type -Path $xeCore;
}

[Microsoft.SqlServer.XEvent.Linq.QueryableXEventData] $xEvents = $null;


    $files = [System.IO.Directory]::EnumerateFiles("d:\YourServerLogPath\OLAP\Log","ETLExecutionLogs*.xel")
    $xEvents = 
        New-Object -TypeName Microsoft.SqlServer.XEvent.Linq.QueryableXEventData(
            $files
        );
    $dt = New-Object System.Data.Datatable;
    $dt.Columns.Add("EventSubclass",[int]);
    $dt.Columns.Add("ObjectType",[int]);
    $dt.Columns.Add("NTCanonicalUserName",[String]);
    $dt.Columns.Add("DatabaseName",[String]);
    $dt.Columns.Add("ObjectPath",[String]);
    $dt.Columns.Add("ObjectID",[String]);
    $dt.Columns.Add("EndTime",[DateTimeOffset]);
    $dt.Columns.Add("StartTime",[DateTimeOffset]);
    $dt.Columns.Add("RequestID",[Guid]);
    $dt.Columns.Add("ReEncoding",[String]);
    
    
    foreach($publishedEvent in $xEvents)
    {
if( ($publishedEvent.Fields["EventSubclass"].value -In 55) -or   ($publishedEvent.Fields["EventSubclass"].Value -In 59 -And $publishedEvent.Fields["ObjectType"].Value -In 802016,802015,802014, 802013, 802018 -And 
      $publishedEvent.Name -eq "ProgressReportEnd" -And $publishedEvent.Fields["Success"].Value -eq "1" ))
        {
            $row = $dt.NewRow();
            
            $row.EventSubclass = $publishedEvent.Fields["EventSubclass"].Value;
            $row.ObjectType = $publishedEvent.Fields["ObjectType"].Value;
            $row.NTCanonicalUserName = $publishedEvent.Fields["NTCanonicalUserName"].Value;
            $row.DatabaseName = $publishedEvent.Fields["DatabaseName"].Value;
            $row.ObjectPath = $publishedEvent.Fields["ObjectPath"].Value;
            $row.ObjectID = $publishedEvent.Fields["ObjectID"].Value;
            $row.EndTime = $publishedEvent.Fields["EndTime"].Value;
            $row.StartTime = $publishedEvent.Fields["StartTime"].Value;
            $row.RequestID = $publishedEvent.Fields["RequestID"].Value;
            $row.ReEncoding = $publishedEvent.Fields["TextData"].Value;
            $dt.Rows.Add($row)
            
        }
    }

    $dt

}