/microsoft-sql-admin:investigate-geo-dr-issues [DatabaseName]from Microsoft SQL administration
Investigates geo-replication issues: secondary lag, suspended links, or unexpected failover group events on SQL Server, Azure SQL DB, Managed Instance, or Fabric.
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.
Auto-detects platform via SERVERPROPERTY('EngineEdition'): SQL DB=5, MI=8, SQL Server=1-4, Fabric=12.
geo-dr-assessment-health-check skill.investigate-ha-issues skill.| Parameter | Default | Description |
|---|---|---|
| DatabaseName | (empty) | Optional DB filter; empty = all databases |
| TopN | 10 | Max rows returned per query |
| LookbackHours | 24 | Recency window for restart/maintenance detection (GetMaintenanceAndScalingEvents) |
master for failover group queries on Azure SQL DB).SELECT @@SERVERNAME, DB_NAME(), SUSER_SNAME(), SERVERPROPERTY('EngineEdition')); if not connected, ask the user for the target.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.KILL), failing over, or changing replication settings are
recommendations only.KILL rolls back the session's open transaction and cannot be
undone, and a failover interrupts connections and can lose data that was not yet replicated.Execute all steps in order. Load and execute queries from references/queries.md — run the SQL exactly as written.
Query: See references/queries.md#getsplitbraindetection
Checks replica roles, sync health, suspended state, quorum, and forced failover history.
| Finding | Action |
|---|---|
Risk = HIGH_RISK (primary NOT SYNCHRONIZING + NOT_HEALTHY) | Possible split-brain — escalate immediately |
Risk = WARNING (suspended replication) | Data movement suspended — check GetReplicationBottleneckAnalysis |
QuorumState = FORCED_QUORUM | Cluster running on forced quorum — risk of data loss on failover |
DB state = SUSPECT or EMERGENCY | Database corruption — do not failover, engage recovery |
UNSUPPORTED platform | Expected for Synapse/Fabric Warehouse — skip |
Query: See references/queries.md#getreplicationbottleneckanalysis
Identifies geo-rep lag, send/redo queue bottlenecks, and synchronization issues.
| Finding | Action |
|---|---|
Bottleneck = LINK_DOWN | Geo-rep link suspended — check network, partner server health |
Bottleneck = STALLED (SecSinceRepl > 120) | No replication progress — investigate partner availability |
Bottleneck = SEND_BOTTLENECK (SendQKB > 100MB) | Network/throughput issue — check bandwidth, log rate |
Bottleneck = REDO_BOTTLENECK (RedoQKB > 100MB) | Secondary can't keep up — check IO/CPU on secondary |
Bottleneck = BOTH_BOTTLENECK | Both send and redo backed up — systematic issue |
Bottleneck = HEALTHY | Replication healthy — proceed to Step 3 |
Query: See references/queries.md#getwaitstats
Captures long-running transactions, log space/rate, and HADR/log waits gating failover.
| Finding | Action |
|---|---|
Readiness = NOT_READY (long txns + active HADR waits) | Do not failover — resolve blocking transactions first |
Readiness = CAUTION (log > 85% or txn log > 1GB) | High log usage — check LogReuseWait for holdup reason |
LogReuseWait not NOTHING/CHECKPOINT | Log truncation blocked — investigate replication, active backup, etc. |
CRITICAL severity on LONG_TXN | Kill or wait for long transaction before failover |
| High HADR wait types (avg > 5s) | Replication transport under pressure — check network |
Query: See references/queries.md#getfailoverhistory
Shows recent role changes, failover events, and forced failover entries.
| Finding | Action |
|---|---|
FORCED_FAILOVER or FORCE_FAILOVER_ALLOW_DATA_LOSS in log | Data loss may have occurred — verify data integrity |
LOST_PRIMARY event | Node lost primary role — correlate with GetMaintenanceAndScalingEvents |
REPL_SUSPENDED event | Data movement was suspended — check if intentional |
| Frequent role transitions (> 2 in 24h) | Flapping — check resource pressure and maintenance events |
MinAgo very large on geo-rep link | Link may be stale — verify with GetReplicationBottleneckAnalysis |
Query: See references/queries.md#getmaintenanceandscalingevents
Detects recent restarts, scaling/SLO operations, and configuration changes. Tune {{LookbackHours}} to adjust the detection window.
| Finding | Action |
|---|---|
RestartedInWindow = YES | Recent restart — correlate timing with failover/lag events |
SCALING_OP state = FAILED or CANCELLED | Failed SLO change — retry or investigate error |
SCALING_OP state = IN_PROGRESS or PENDING | Scaling in progress — wait for completion before failover |
CONFIG_CHANGE event | Configuration changed — verify if intentional |
| No events in window | No maintenance activity — issue is likely workload-driven |
Query: See references/queries.md#getresourcepressure Note: This query contains two 1-second
WAITFOR DELAYsnapshots — inform the user before executing.
Measures CPU, IO, memory, scheduler, and signal-wait pressure.
| Finding | Action |
|---|---|
CPUPct >= 90 or SQLCPUPct >= 90 | CPU saturation — check for runaway queries, missing indexes |
DataIOPct >= 90 or AvgReadMs >= 50 | IO bottleneck — check for table scans, storage throttling |
LogWritePct >= 90 | Log IO pressure — use the investigate-sql-log-io-pressure skill |
GrantsPending > 0 | Memory grant waits — queries queuing for memory |
AvgRunnable >= 5 | Scheduler pressure — CPU oversubscription |
MemState contains low | System-wide memory pressure — check for memory-intensive queries |
Prioritize findings: OK < WARNING < CRITICAL. Address CRITICAL items first.
All diagnostic T-SQL lives in references/queries.md. Each query is platform-aware (auto-detects EngineEdition) and is run with the SQL query tool.
sys.dm_geo_replication_link_status) are not available in master — connect to a user database.gl.last_replication is datetimeoffset (UTC) — queries use SYSUTCDATETIME() (not SYSDATETIME()) for DATEDIFF comparisons.GetResourcePressure contains two 1-second WAITFOR DELAY snapshots. Warn the user before executing.sys.dm_db_resource_stats is not supported on MI (@E=8) — MI uses sys.server_resource_stats instead.secondary_lag_seconds column requires SQL 2016 SP2 / 2017+; the query gracefully emits NULL on older builds.health-audit-sqlserver, check-live-blocking, and wait-category-analysis skillsWhat SKILL.md sets; muted values are Claude Code's defaults
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