sqlerrorlog-review — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited sqlerrorlog-review (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Parse and analyze SQL Server ERRORLOG content to surface operational warnings, high-availability failures, resource pressure signals, security events, and configuration anomalies. Applies 33 checks (E1–E33) across six categories:
Accept any of:
C:\Program Files\Microsoft SQL Server\MSSQL<ver>.<inst>\MSSQL\Log\ERRORLOG)
For best results, provide the current ERRORLOG and at least one prior log (ERRORLOG.1). When only partial content is available, state which time range is covered.
-- Read current ERRORLOG (0 = current, 1 = previous, 2 = the one before that)
EXEC xp_readerrorlog 0, 1; -- SQL Server log, current file
EXEC xp_readerrorlog 1, 1; -- SQL Server log, previous file
-- Filter to AG-related messages only
EXEC xp_readerrorlog 0, 1, N'availability', NULL, NULL, NULL, N'desc';
-- Filter to a time window (last 2 hours)
DECLARE @start DATETIME = DATEADD(HOUR, -2, GETDATE());
EXEC xp_readerrorlog 0, 1, NULL, NULL, @start, NULL, N'desc';| Column | Meaning |
|---|---|
| LogDate | Timestamp of the log entry (datetime2 precision) |
| ProcessInfo | SPID or system process (e.g., spid28s, Logon, Backup) |
| Text | Log message text |
| Threshold | Value | Used by |
|---|---|---|
| Login failure burst — Warning | > 5 Login failed messages in any 5-min window | E22 |
| Login failure burst — Critical | > 20 Login failed messages in any 5-min window | E22 |
| Restart cycling | ≥ 2 SQL Server startup messages within 60 min | E21 |
| I/O slow built-in threshold | 15 seconds (SQL Server internal, non-configurable) | E15 |
| Log backup overdue — FULL/BULK_LOGGED | > 24 hr since last Database backed up entry | E18 |
| Log backup overdue — active log pressure signal | > 8 hr when log_reuse_wait_desc = LOG_BACKUP | E18 |
is changing roles from or is preparing to transition to or automatic failoverin the same entry or within the same minute as a role-change message; also in response to a request from the Windows Server Failover Cluster
automatic appears(unplanned loss of primary)
probable root causes. For planned failovers in unexpected windows, review change-management records. Run /sqlwait-review on HADR_SYNC_COMMIT and HADR_WORK_QUEUE waits.
Cluster has expired or The lease of availability group combined with has expired`
(non-yielding scheduler), or OS-level events. Common causes: storage latency spike causing the sp_server_diagnostics thread to miss its deadline, high CPU starvation, or WSFC network interruption. Increase LeaseTimeout in WSFC only as a temporary measure — fix the root cause.
The local replica of availability group ... is changing roles oris preparing to transition to the
transitions during business hours warrant investigation
If unplanned, check the Windows Event Log and WSFC cluster log for the triggering event.
Failed to join local availability database or `The availabilitydatabase ... is not in the correct state`
synchronized, providing false HA coverage
SELECT * FROM sys.dm_hadr_database_replica_states to checksynchronization_state_desc and redo_queue_size. If redo queue is growing, check disk I/O on the secondary. If the database is in NOT SYNCHRONIZING, re-join: ALTER DATABASE [db] SET HADR AVAILABILITY GROUP = [ag_name].
Synchronization of this database ... has been suspended orData movement for availability database ... has been suspended
ALTER DATABASE ... SET HADR SUSPEND) orautomatic (error-triggered). Check for E15/E16 (I/O or corruption) causing automatic suspension. Resume: ALTER DATABASE [db] SET HADR RESUME. Monitor redo queue.
the time allotted or The availability group ... exceeded the health-check timeout`
combined with E1 confirms the full failover sequence
(page allocation failure) are common co-occurrences. The HealthCheckTimeout WSFC property controls sensitivity — do not increase it without fixing the underlying responsiveness problem.
An error occurred in the redo thread for database orRedo thread for database ... encountered error
applying log records and RPO is accumulating
(check E16), log record version mismatch after an upgrade, or disk full on secondary. For disk-full, free space and resume synchronization. For corruption, restore the secondary from a backup and re-seed.
Waiting for redo catch-up or mentions secondary redo queue in awarning context; or log send queue appearing repeatedly with growing values
loss proportional to the redo queue depth
SELECT redo_queue_size, redo_rate FROM sys.dm_hadr_database_replica_states. If redo rate < log generation rate, the secondary cannot keep up — review disk I/O on secondary (E15) or increase network bandwidth.
FAIL_PAGE_ALLOCATION (exact string, case-insensitive)may have failed with out-of-memory errors; this entry often precedes OS paging (E10)
max server memory configuration (E26). RunSELECT type, pages_kb FROM sys.dm_os_memory_clerks ORDER BY pages_kb DESC to identify which clerk is consuming the most memory. Consider reducing max server memory by 10–15% to leave headroom for OS and other processes.
A significant part of sql server process memory has been paged outor Working set trim
buffer pool pages are on disk, causing extreme I/O latency
max server memory to allow OS headroom (leave at least 10% of RAM or 4 GB,whichever is greater). Enable Lock Pages in Memory (LPIM) to prevent paging for 64-bit SQL Server service account. Investigate other processes competing for RAM on the host.
There is insufficient memory available in the buffer pool (error 802, buffer pool full) OR There is insufficient system memory in resource pool (error 701, Resource Governor pool exhausted) OR Memory Manager: Memory node available memory is less than thresholdRESOURCE_SEMAPHORE waits/sqlwait-review and check for RESOURCE_SEMAPHORE dominance. Increase max server memory if physical RAM allows, or reduce min memory per query via Resource Governor. Identify large-grant queries with /sqlplan-review S2–S4. Error 802 (buffer pool) and error 701 (resource pool) require different fixes: 802 → increase max server memory or reduce buffer pool competition; 701 → adjust Resource Governor pool memory limits.There are no more threads available to process new requests orWorker Thread ... has been waiting too long
maximum worker thread capacity
max worker threads via sp_configure only after identifying root cause.Common causes: blocking chains holding threads (check sys.dm_exec_requests), long-running queries, or undersized max worker threads for the workload. Run /sqlwait-review for THREADPOOL waits (V-checks).
Process appears to be non-yielding on Scheduler orA scheduler appears to be non-yielding
all other threads on that scheduler, degrades responsiveness, and can trigger AG health-check timeouts (E6) and lease expiry (E2)
.mdmp file in theSQL Server Log directory matching the timestamp. Common causes: large in-memory sort, CLR call, XTP operation, or a bug in a specific build — check if a known hotfix applies for the version (E28). Consider enabling DBCC TRACEON(8086) on advice from Microsoft Support.
Memory grant request timed out orA request for memory failed with OOM (out of memory) status
timeout; it may have been killed or retried with a reduced grant, causing a spill to TempDb
/sqlplan-review for S2–S4 (memory grant checks).Update statistics to improve cardinality estimates. Use Resource Governor to cap grants for ad-hoc workloads. Check for E11 (resource pool exhaustion) as a co-trigger.
SQL Server has encountered combined with `I/O requests takinglonger than 15 seconds` (SQL Server's built-in slow I/O threshold)
this is a primary trigger for AG lease expiry (E2) and health-check timeouts (E6)
disk queue length, RAID controller cache status, SAN/NVMe latency metrics, and any concurrent backup or maintenance operations competing for I/O. If on a VM, check storage IOPS limits. Run /sqlwait-review for PAGEIOLATCH_SH and PAGEIOLATCH_EX dominance.
checksum mismatch, torn page, consistency errors detected,DBCC CHECKDB found with error counts > 0, Error: 823 (OS-level I/O failure — Windows API returned an error), Error: 824 (logical consistency check failure — Windows I/O succeeded but SQL detected corruption on the page), or Error: 825 (read succeeded after retry — transient storage issue; Warning severity; indicates potential hardware degradation)
(read ultimately succeeded but is a precursor to harder failures — investigate storage hardware immediately); Critical if DBCC CHECKDB reports allocation or consistency errors
DBCC CHECKDB ([database]) WITH NO_INFOMSGS immediately to assess scope. Donot attempt to repair until a current, verified backup exists. For REPAIR_ALLOW_DATA_LOSS, treat it as a last resort — restore from backup is always preferable. Investigate E15 (I/O latency) and storage hardware health as root causes.
Could not allocate space combined with in database 'tempdb'or tempdb is full or tempdb ran out of space
versioning) are failing; error 1105 is returned to applications
DBCC SHRINKFILE on tempdb data files to recover any unused allocatedspace, or add a tempdb data file. Long term: investigate which query is consuming tempdb (check sys.dm_db_session_space_usage). Run /sqlplan-review for N41–N43 (spill operators). Consider pre-allocating tempdb to expected working size at startup.
Database backed up entries for the same databaseexceeds the threshold for that recovery model. For databases in FULL or BULK_LOGGED recovery, flag if the gap exceeds 24 hours; flag more urgently if log backup entries are absent while other evidence suggests active transaction log growth
recovery database, the log cannot be truncated until backed up
BACKUP LOG [database] TO DISK = N'path\logbackup.bak'.Verify the SQL Agent log backup job is scheduled and enabled. Check sys.databases column log_reuse_wait_desc — if LOG_BACKUP, the log is waiting for a backup to allow truncation.
autogrow events on transaction log files (multiple autogrowcompletions in the log window), or the database log has grown significantly between ERRORLOG entries — inferred from repeated log file path growth messages
events indicate the log was not sized for the workload
set and disable autogrow on the log (or set a large, infrequent growth increment). Run DBCC LOGINFO ([database]) to count current VLFs — if > 1,000, shrink and re-expand in one step. Align with E18 (log backup cadence) to ensure the log truncates regularly.
SQL Server is terminating or SQL Server has encountered combinedwith stack dump or shutdown messages, without a preceding graceful shutdown marker (SQL Server is terminating due to a system shutdown request at the end of the prior log file)
transactions were rolled back on restart; any in-flight work is lost
Application and System sources) for the crashtimestamp. Look for a dump file in the SQL Server Log directory. If the crash occurred mid-transaction in an AG, check whether secondary databases advanced beyond the primary (split-brain risk). Engage Microsoft Support with the minidump if the crash is reproducible.
messages (lines containing SQL Server is starting or This instance of SQL Server last reported using a process ID) within a 60-minute window
connection state; applications experience repeated connection failures
is restarting due to a failed startup condition (e.g., tempdb creation failure, master database corruption, or xp_cmdshell misconfiguration), resolve the startup error first. Enable Windows Automatic Recovery only after identifying the underlying fault.
Login failed entries exceeds the threshold within a 5-minute rollingwindow — see Thresholds Reference for Warning and Critical levels
ClientConnectionID and source IP in the failure messages. A burst fromone account likely indicates a misconfigured application connection string after a password rotation. A burst from many accounts may indicate a brute-force attempt. For brute-force: enable SQL Server Audit or Extended Events on Failed Logins and block the source IP at the network layer. Ensure LOGINAUDIT is set to Failed logins only or Both in Server properties so future bursts appear in the ERRORLOG.
OLE DB provider combined with reported an error orCannot obtain the required interface for a linked server provider
linked server will fail until the provider error is resolved
target server unavailable, credential expiry, or OLE DB provider version mismatch. Test connectivity: EXEC sp_testlinkedserver [linked_server_name]. If the provider is outdated, update it on the SQL Server host.
then an error occurred during the login process or The connection has been lost or A network-related or instance-specific error` in the ERRORLOG (as opposed to the client)
(linked servers, distributed queries, SSISDB, mail, replication) or from incoming connections that dropped after TCP establishment
or TLS/SSL certificate renewals. If TLS handshake appears in the message, verify that the certificate in use has not expired and that the client supports the negotiated protocol.
Trace flag combined with is set or was enabled at startupin startup messages
are still appropriate for the current SQL Server version
DBCC TRACESTATUS(-1). Common production trace flagsand their intent: 1117/1118 (tempdb allocation — superseded in 2016+), 3226 (suppress successful backup log entries), 4199 (QO hotfixes). Remove trace flags that are no longer needed or that apply to behaviour fixed in a later CU.
max server memory = 2147483647 MB, or theinstance has been running with the default (unlimited) memory configuration — inferred from startup messages or the absence of an explicit max server memory setting entry
the OS and any other services, which can trigger E10 (OS paging)
max server memory to total RAM minus OS headroom: leave at least 10% of RAM or4 GB (whichever is larger) for the OS. For example, on a 64 GB server: EXEC sp_configure 'max server memory (MB)', 57344; RECONFIGURE;
with no prior context from ERRORLOG.1 or earlier
AG failovers, or earlier memory events) are not visible; findings may be incomplete
EXEC xp_readerrorlog 1, 1 throughEXEC xp_readerrorlog 6, 1 (SQL Server retains up to 6 prior logs by default, configurable in SSMS → Server Properties → Database Settings → Number of error log files). State in the report: "Analysis covers [start] – [end] only; prior events not available."
Microsoft SQL Server 20XX version string — presentin every ERRORLOG at instance start
support, or past end-of-support? (2) is this the latest CU for this major version?
If past end-of-support (e.g., SQL 2014 Extended Support ended 2024-07-09 — 2019 was only its mainstream support end; SQL 2016 Extended Support ends 2026-07-14), plan upgrade. If not on the latest CU, evaluate whether open bugs fixed in later CUs are relevant to the observed issues. Report the version string verbatim in the Output Summary.
Persistent Version Store cleanup with stall or unable to advance — SQL 2019+; skip if compat level < 150SELECT * FROM sys.dm_tran_active_transactions WHERE transaction_begin_time < DATEADD(MINUTE,-10,GETUTCDATE()). Commit or roll back idle transactions. If the issue recurs, verify ADR is intentional — disable with ALTER DATABASE [db] SET ACCELERATED_DATABASE_RECOVERY = OFF if not needed.DOP feedback with adjusted or applied to — SQL 2022+ only; skip if compat level < 160sys.query_store_plan_feedback to see which queries received DOP adjustments and whether the feedback stabilized. If a DOP reduction caused regressions, force a plan or disable feedback for that query: EXEC sys.sp_query_store_set_hints @query_id = N'<id>', @query_hints = N'OPTION(USE HINT(''DISABLE_DOP_FEEDBACK''))'.Ledger verification with failed or tamper detected — SQL 2022+ onlysys.sp_verify_database_ledger and sys.sp_verify_database_ledger_from_digest_storage to determine scope. Preserve the ERRORLOG and all ledger digests for forensic analysis. Do not modify the affected tables until investigation is complete. Escalate to a security incident response process.Cardinality Estimation feedback with model version change message — SQL 2022+ only; skip if compat level < 160sys.query_store_plan_feedback to see affected queries. To disable CE feedback for a specific query: EXEC sys.sp_query_store_set_hints @query_id = N'<id>', @query_hints = N'OPTION(USE HINT(''DISABLE_CE_FEEDBACK''))'.Arc SQL extension with disconnected or heartbeat failure message — any SQL Server version with Azure Arc agent installedGet-Service -Name 'himds' and the SQL extension Get-Service -DisplayName 'Microsoft SQL Server Extension Service' (Windows; the service runs as NT SERVICE\SqlServerExtension — on Linux the service is named SqlServerExtension). There is no ArcSqlInstanceExtension service. Verify outbound connectivity to *.arc.azure.com and *.<region>.arcdataservices.com on port 443. Restart the extension service if it is stopped. Review Arc agent logs at %ProgramData%\GuestConfig\arc_policy_logs\ for detailed error messages.If the SQL Server version is known — from the startup banner in the ERRORLOG (e.g. SQL Server 2019 (RTM-CU18)...) or stated by the user — read VERSION_COMPATIBILITY.md (~/.claude/skills/VERSION_COMPATIBILITY.md if installed, or skills/VERSION_COMPATIBILITY.md from the repo). If unavailable, skip silently. For checks whose minimum version exceeds the instance version: verbose mode → log as SKIP (version: requires SQL 20XX+, instance is SQL 20YY); standard report → omit entirely. Do not suppress NOT ASSESSED rows from missing input — only suppress version-inapplicable checks.
Structure the report as follows. Use this exact section order.
## SQL Server ERRORLOG Analysis
### Summary
- X Critical, Y Warnings, Z Info
- Time range: [first log entry datetime] – [last log entry datetime]
- SQL Server version: [version string from E28 startup line, or "Not found in provided excerpt"]
- Highest-risk finding: [check name and ID, e.g., "E2 — Lease Expiry"]
- Log coverage note: [single file / multiple files / partial excerpt — dates if known]
### Critical Issues
### [C1 — E2] Lease Expiry (2026-01-15 14:32:05)
- **Observed:** "lease between the availability group 'AG1' and the Windows Server Failover
Cluster has expired" at 14:32:05. Preceded by E15 (I/O slow) at 14:28:44 on
E:\Data\AG1_Primary.mdf.
- **Impact:** Unplanned AG failover triggered. AG1 primary role transferred to secondary.
Applications lost primary connection for the duration of the failover.
- **Fix:** Investigate I/O latency on E:\Data at 14:28 (see C2 — E15). Do not increase
LeaseTimeout without resolving the root cause I/O delay.
### Warnings
### [W1 — E1] AG Failover Event (2026-01-15 14:32:08)
...
### Info
### [I1 — E25] Trace Flag Active (startup)
...
### Passed Checks
| Check | Result |
|-------|--------|
| E9 — FAIL_PAGE_ALLOCATION | PASS — no FAIL_PAGE_ALLOCATION entries found |
| E16 — Database Corruption Warning | PASS — no checksum or torn-page errors found |
---
*Analyzed by: [state the AI model and version you are running as, e.g. "Claude Sonnet 4.6", "DeepSeek R1", "GPT-4o"] · [current date and time in the user's local timezone, or UTC if timezone is unknown, e.g. "2026-05-16 20:15 NZST"]*Each finding label uses [C1], [W1], [I1] sequence numbering, with the check ID in parentheses. Findings reference related checks by ID where one explains another (e.g., "root cause of C1 — E2"). Passed Checks must list every check explicitly evaluated. When a check cannot be evaluated (e.g., E18 with no backup log entries), state "SKIP — no Database backed up entries in provided log window" rather than PASS or FAIL.
spid28s (or any spidNs) are system threads; Logon is the login auditingthread; Backup is the backup thread.
beginning of a new SQL Server process (i.e., a restart occurred between files).
errors) appear only in the Windows Event Log and WSFC cluster log. Reference the companion skill list below for those artifacts when ERRORLOG evidence points to external causes.
Database backed up entries are present — the absenceof backup log entries is itself an E18 signal for databases in FULL recovery. State clearly which databases had backup evidence and which did not.
`--brief` — Omit the Passed Checks table and attribution footer. Output the Summary, Findings, and Prioritized Fix Sequence sections only. Use when a quick scan of what fired is all that's needed.
`--critical-only` — Suppress Warning and Info findings. Show only Critical findings. The Passed Checks table is also omitted. Use when triaging an incident and only actionable blockers matter.
Both flags can be combined: --brief --critical-only produces the Summary section plus Critical findings only.
When neither flag is present, produce the full report as documented above.
When the user's request includes --verbose, --trace, or the word verbose:
1. Append a `## Check Evaluation Log` section after the Passed Checks table.
Include one row for every check in this skill's ruleset, in check-ID order:
| Check | Evidence | Threshold | Result |
|---|---|---|---|
| [ID — Name] | [key attribute(s) and value found, or "absent"] | [threshold or condition] | PASS / FIRE → [severity] / NOT ASSESSED |
Result conventions:
PASS — attribute present, threshold not met**FIRE → Critical/Warning/Info** — threshold met; bold to distinguish from passesNOT ASSESSED — required attribute absent from input2. Save both files to the current working directory using the Write tool:
output/<skill-name>/<YYYY-MM-DD-HHmmss>-<input-prefix>/analysis.md ← full report output/<skill-name>/<YYYY-MM-DD-HHmmss>-<input-prefix>/trace.md ← Check Evaluation Log
Derive <input-prefix>:
horrible.sqlplan → horrible)runSanitize: alphanumeric + hyphens/underscores only, max 32 chars.
File headers: analysis.md → # Analysis — <skill-name> / # Input: <first 80 chars> / # Generated: <UTC timestamp> trace.md → # Check Evaluation Log — <skill-name> / # Input: <first 80 chars> / # Generated: <UTC timestamp>
Create directories as needed. When --verbose is not present, write nothing to disk.
/sqlwait-review — correlate ERRORLOG memory and I/O signals (E9–E15) withPAGEIOLATCH_SH, RESOURCE_SEMAPHORE, HADR_SYNC_COMMIT, and THREADPOOL wait dominance
/sqlplan-review + /sqlindex-advisor — analyze execution plans for queries that wererunning during the incident window; high-cost queries during a memory or I/O event often accelerate the failure
/sqlquerystore-review — identify plan regressions introduced after a post-incident restartclears the plan cache, causing previously stable queries to recompile with bad plans
/tsql-review — review T-SQL source of stored procedures flagged during the incident ashigh resource consumers before and after the failure
/sqldeadlock-review — if E22 (login failure burst) or connectivity errors coincide with error1205 in application logs, analyze the deadlock XML from the system_health XE session
/sqlspn-review — when E22 (login failure burst) shows Kerberos-specific errors (17806, 17807,error 0x8009030c) or "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'", sqlspn-review identifies the missing or duplicate SPN and delegation misconfiguration as root cause
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.