Seen on a customer's SQL Server 2005 SP4 (legacy ODBC): - agent-jobs declared @since with an initial value (2008+): "Incorrect syntax near CONVERT" and SQLI-JOB-001/002 never ran. Now DECLARE; SET. - plan-analysis used query_hash (2008+) and failed every 30 minutes for SQLI-PLAN-001/002/003. On 2005 a statement is now identified by sql_handle + offsets, as top SQL does. It needs sys.dm_exec_text_query_plan, so the new capability TextQueryPlan (2005 SP2, 9.0.3042) is required. - COM-DB-001 used OBJECT_SCHEMA_NAME (2005 SP2+); now joins sys.objects and sys.schemas. Audit of all collector SQL and community rules without minimumVersion 10.0: the rest is 2005 syntax or behind a version/capability check. Sql2005CompatibilityTests (2005 cannot run in CI): every collector that can run on 2005 is scanned for 2008+ syntax in its SQL (inline DECLARE, +=, MERGE, CONCAT/IIF/FORMAT/TRY_*, OFFSET/FETCH, date/time types, multi-row VALUES), version-branched files listed explicitly; the same for community rules; and the 2005 variants of plan analysis and top SQL must not use query_hash. Verified to fail on the old agent-jobs SQL. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
67 lines
2.6 KiB
C#
67 lines
2.6 KiB
C#
namespace SQLInsight.Core.Instances;
|
|
|
|
/// <summary>
|
|
/// Something a collector or rule depends on that not every SQL Server version or configuration offers.
|
|
/// </summary>
|
|
public enum Capability
|
|
{
|
|
/// <summary>
|
|
/// The customer runs the server: backups, patching, files, tempdb and host configuration are theirs to manage.
|
|
/// Absent on Azure SQL Managed Instance, where Azure does it.
|
|
/// </summary>
|
|
SelfManagedInfrastructure,
|
|
|
|
/// <summary>Dynamic management views (<c>sys.dm_*</c>). SQL Server 2005+.</summary>
|
|
DynamicManagementViews,
|
|
|
|
/// <summary>The always-on default trace. SQL Server 2005+.</summary>
|
|
DefaultTrace,
|
|
|
|
/// <summary>The <c>VIEW SERVER STATE</c> permission, so monitoring does not need sysadmin. SQL Server 2005+.</summary>
|
|
ViewServerStatePermission,
|
|
|
|
/// <summary>Extended Events. SQL Server 2008+.</summary>
|
|
ExtendedEvents,
|
|
|
|
/// <summary>The built-in <c>system_health</c> Extended Events session (deadlock graphs). SQL Server 2008+.</summary>
|
|
SystemHealthSession,
|
|
|
|
/// <summary><c>system_health</c> writes to a file target, so history survives the ring buffer. SQL Server 2012+.</summary>
|
|
SystemHealthFileTarget,
|
|
|
|
/// <summary>Always On availability group DMVs exist. SQL Server 2012+.</summary>
|
|
AvailabilityGroupDmvs,
|
|
|
|
/// <summary>Always On is enabled on this instance (runtime setting, not just the version).</summary>
|
|
HadrEnabled,
|
|
|
|
/// <summary>The <c>CONNECT ANY DATABASE</c> permission. SQL Server 2014+.</summary>
|
|
ConnectAnyDatabasePermission,
|
|
|
|
/// <summary>Query Store. SQL Server 2016+.</summary>
|
|
QueryStore,
|
|
|
|
/// <summary><c>sys.dm_exec_session_wait_stats</c>. SQL Server 2016+.</summary>
|
|
SessionWaitStats,
|
|
|
|
/// <summary><c>DATABASEPROPERTYEX(..., 'LastGoodCheckDbTime')</c>, so CHECKDB status does not need sysadmin. SQL Server 2016 SP2+.</summary>
|
|
LastGoodCheckDbTime,
|
|
|
|
/// <summary><c>sys.dm_db_log_info</c>, so VLFs can be counted without sysadmin. SQL Server 2016 SP2+.</summary>
|
|
LogInfoDmv,
|
|
|
|
/// <summary>
|
|
/// Memory grant and spill columns in <c>sys.dm_exec_query_stats</c> (total_grant_kb, total_spills …).
|
|
/// SQL Server 2016 SP2+ and 2017 CU3+.
|
|
/// </summary>
|
|
QueryStatsMemoryColumns,
|
|
|
|
/// <summary><c>sys.dm_exec_query_plan_stats</c> (last actual execution plan). SQL Server 2019+.</summary>
|
|
LastActualPlan,
|
|
|
|
/// <summary>Granular server permissions such as <c>VIEW SERVER PERFORMANCE STATE</c>. SQL Server 2022+.</summary>
|
|
GranularServerPermissions,
|
|
|
|
/// <summary><c>sys.dm_exec_text_query_plan</c> (cached plans as text, per statement). SQL Server 2005 SP2+.</summary>
|
|
TextQueryPlan,
|
|
}
|