/microsoft-sql-admin:investigate-ha-issues [AGName] [LookbackMinutes] [RedoQueueThresholdKB] [LogSendQueueThresholdKB] [SnapshotDurationSeconds]from Microsoft SQL administration
Investigates SQL Server, Azure SQL, and Fabric availability group sync/failover issues: suspended replicas, NOT SYNCHRONIZING, growing redo/log send queues, lease timeouts, failed seeding.
Ships in Microsoft SQL administration. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Primary entry point for HA investigations across SQL Server, Azure SQL, and Fabric. Use when users report AG sync issues, unhealthy replicas, failovers, large redo/log send queues, seeding failures, lease timeout symptoms, or geo-replication lag.
This skill follows a 12-step workflow:
investigate-geo-dr-issues skill.ha-assessment-health-check skill.microsoft-sql-admin plugin (mssql_list_database_connections,
mssql_connect_database, then mssql_execute_query); any other SQL tool the agent host provides for
running T-SQL and reading result sets;
sqlcmd from a terminal. If the SQL
Tools MCP server is not connected or lists no connections, follow the sql-tools-mcp-setup skill,
which asks before installing or configuring anything. If no SQL tool can be made available, give the
user the T-SQL to run and ask for the results.VIEW SERVER PERFORMANCE STATE (VIEW SERVER STATE before SQL Server 2022) or, on Azure
SQL Database, VIEW DATABASE PERFORMANCE STATE or ##MS_ServerStateReader##, plus any other read
permission these queries need. A tool is only as read-only as the login it connects with.SELECT @@SERVERNAME, DB_NAME(), SUSER_SNAME(), SERVERPROPERTY('EngineEdition')).references/queries.md with the SQL query tool.| Parameter | Default | Description |
|---|---|---|
| AGName | (optional) | Filter to a specific availability group name. If omitted, shows all AGs |
| LookbackMinutes | 60 | How far back to look for failover events and state changes |
| RedoQueueThresholdKB | 100000 | Redo queue size (KB) threshold for warnings (~100 MB) |
| LogSendQueueThresholdKB | 50000 | Log send queue size (KB) threshold for warnings (~50 MB) |
| SnapshotDurationSeconds | 30 | Duration for HADR wait statistics snapshot |
ALTER DATABASE ... SET HADR RESUME and
ALTER EVENT SESSION ... STATE = START) are recommendations only.Load and execute the Step 1 query from references/queries.md. It determines edition, version, EngineEdition, and whether HADR is enabled.
Routing: editions 1/4/6/9/11 stop; edition 5 or 12 skips to Step 12; editions 2/3/8 with HADR enabled proceed to Steps 2–11.
Load and execute the Step 2 query from references/queries.md to review AG topology, sync mode, failover mode, session timeout, health timeout, seeding mode, and endpoint URL.
Key signals: aggressive failure_condition_level, invalid automatic failover + async combinations, risky timeouts, and automatic seeding choices.
Load and execute the Step 3 query from references/queries.md to inspect replica role, operational state, connectivity, sync health, recovery health, and last connection errors.
Key signals: RESOLVING, DISCONNECTED, NOT_HEALTHY, PENDING_FAILOVER, or populated last_error_number / last_error_description.
Load and execute the Step 4 query from references/queries.md. This is the primary per-database view for sync_state, sync_health, redo queue, log send queue, redo/log send rates, and estimated RPO/RTO impact.
Key signals: queue sizes above thresholds, NOT SYNCHRONIZING, old last_redone_time, long estimated redo/log drain times, and non-null suspend_reason.
Load and execute the Step 5 query from references/queries.md to capture a SnapshotDurationSeconds delta for HADR-related waits.
Key signals: dominant HADR_SYNC_COMMIT, HADR_CLUSAPI_CALL, HADR_LOG_BLOCK_FLUSH, PARALLEL_REDO_*, DIRTY_PAGE_TABLE_LOCK, or REDO_THREAD_PENDING_WORK waits.
Load and execute the Step 6 query from references/queries.md to pull recent AlwaysOn_health ring buffer transitions and AG-related error-log entries.
Key signals: repeated state changes, RESOLVING -> PRIMARY transitions, lease timeout 19407, connection timeout 35206, join error 35201, or a missing AlwaysOn_health session.
Load and execute the Step 7 query from references/queries.md to validate the database mirroring endpoint used by AG transport.
Key signals: stopped or disabled endpoints, missing endpoints, auth mismatches, disabled encryption, and endpoint-port firewall issues.
Load and execute the Step 8 query from references/queries.md for an outbound transport view by database.
Key signals: growing log_send_queue_size_kb, time_to_drain_sec > 60, high send/receive latency, high receive/harden latency, or zero send rate with a non-zero queue.
Load and execute the Step 9 query from references/queries.md while connected to the secondary replica.
Key signals: redo blocked by DIRTY_PAGE_TABLE_LOCK, storage waits such as PAGEIOLATCH_* or WRITELOG, PARALLEL_REDO_TRAN_TURN, REDO_THREAD_PENDING_WORK, or a blocking session.
Load and execute the Step 10 query from references/queries.md only for box-product SQL Server on-premises or IaaS VMs.
Key signals: non-normal quorum, down members, missing witness, missing cluster metadata, single-node membership, or no public cluster network.
Load and execute the Step 11 query from references/queries.md only on SQL Server 2016+ or Azure SQL Managed Instance.
Key signals: failed or stalled automatic seeding, low transfer rate, pct_complete not moving, or seeding completed without the database reaching SYNCHRONIZED.
Load and execute the Step 12 query from references/queries.md only for Azure SQL Database (EngineEdition 5) and Fabric SQL Database (EngineEdition 12).
Key signals: replication_lag_sec > 30, prolonged CATCH_UP, SEEDING, SUSPENDED, missing geo-replication rows, or being connected to the secondary role.
Use references/report-template.md to assemble findings into the final report. It contains the report template plus the root-cause decision tree for resolving RESOLVING replicas, large redo/log send queues, dominant HADR waits, seeding failures, geo-replication lag, and frequent failovers.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
sql-server, availability-group, hadr, disaster-recovery, geo-replication
npx claudepluginhub microsoft/microsoft-sql --plugin microsoft-sql-admin47 skills in this plugin
/active-connectionsUse when the user asks who is connected, which sessions are idle or hold the oldest open transaction, or how connections split by login or app. If a client can't connect, use `connectivity-troubleshoot`./always-encrypted-columnsUse when the user asks which plaintext columns can or should use Always Encrypted, or why a column is disqualified. Eligibility only: not for listing already-encrypted columns or their keys./authentication-diagnosticsUse when a login fails (18456, 'Login failed for user'), a user can't open a database, a permission is denied, or an Entra or managed identity login fails. For network errors, use `connectivity-troubleshoot`.Other plugins' skills for the same job