sqlinsight-pro/src/SQLInsight.Web/Components/Shared/LongOperationTable.razor
Søren Eggert Lundsteen Olsen 384e1f154f Long operations, full-text rules and statement activity
- Long operations: a one-minute collector reads operations with progress
  from sys.dm_exec_requests (BACKUP, RESTORE, DBCC, REORGANIZE, SHRINK,
  ROLLBACK): command, database, start, percent, expected end, login.
  Stored in insight.LongOperations (migration 0011, RawDays), shown on
  the instance page, in the time window analysis and its PDF. The last
  10 durations per command and database survive restarts; SQLI-OPS-001
  flags a backup/restore running over twice the median.
- Full-text community rules COM-FT-001..005 (metadata only, 2005 syntax):
  disk-full or paused/throttled catalogs, stale manual/off change
  tracking indexes and disabled indexes.
- Statement activity (CPU time / time in plan cache): column in top SQL
  and SQLI-CPU-002 when above SQLInsight:TopSql:ActivityThresholdPercent
  (default 50) for at least an hour. Never clears the plan cache.
- BuiltInCollectors.Create takes a CollectorSettings record.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 09:07:29 +02:00

37 lines
1.7 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@inject Display Display
@* Long operations with progress (BACKUP, RESTORE, DBCC …). Logins are shown locally only. *@
@if (Operations.Count == 0)
{
<p class="muted">@Empty</p>
}
else
{
var now = DateTime.UtcNow;
<table>
<thead><tr><th>Kommando</th><th>Database</th><th>Startet</th><th class="num">Varighed</th><th class="num">Færdig</th><th>Forventet slut</th><th>Login</th></tr></thead>
<tbody>
@foreach (var o in Operations)
{
var running = o.IsRunning(now);
<tr>
<td>@o.Command</td>
<td>@(o.DatabaseName ?? "–")</td>
<td class="nowrap">@Display.Time(o.StartedAt)</td>
<td class="num nowrap">@Duration(running ? now - o.StartedAt : o.Duration)</td>
<td class="num">@(running ? $"{Display.Number(o.PercentComplete, 1)} %" : "afsluttet")</td>
<td class="nowrap">@(running && o.EstimatedEnd is { } end ? Display.Time(end) : "–")</td>
<td class="mono">@(o.LoginName ?? "–")</td>
</tr>
}
</tbody>
</table>
<p class="muted">Operationer, som SQL Server viser fremskridt for (percent_complete): backup, restore, DBCC, indexvedligehold med REORGANIZE, shrink og rollback. Målt hvert minut; varigheden af afsluttede er til sidst set.</p>
}
@code {
[Parameter, EditorRequired] public IReadOnlyList<StoredLongOperation> Operations { get; set; } = [];
[Parameter] public string Empty { get; set; } = "Ingen langvarige operationer.";
private static string Duration(TimeSpan value) => value.TotalHours >= 1 ? $"{(int)value.TotalHours} t {value.Minutes} min" : $"{Math.Max(0, (int)value.TotalMinutes)} min";
}