Get-sqmMemoryDump
Diagnostics
sqmSQLTool v1.9.207.0+ · Get
SQLDump<n>.mdmp) of an instance and works out why each one was written. SQL Server writes a dump on severe errors such as an access violation, an assertion, a non-yielding scheduler, out of memory or a latch timeout. The files are large, and from the outside they do not say what caused them.
The dumps come from
sys.dm_server_memory_dumps (file, time, size). For each one the SQL error log around the time the dump was written is read and classified: error numbers (17066 assertion, 17883 non-yielding scheduler, 701 out of memory, 823/824/825, 844–847 and others), exception code, address and module (for example sqllang+0x...), the SPID and the input buffer of the triggering statement, plus a short hint on what to check next. The result also carries ProductVersion, because many crashes are fixed in a later cumulative update.
This is a first assessment from the error log, not an analysis of the dump. The cause inside SQL Server needs the dump itself (Microsoft Support or WinDbg), but the output usually names the session and statement involved. Older builds also write "Stack Dump being sent to ...SQLDump<n>.txt" to the error log, which is used to refine the match; newer builds such as SQL Server 2025 do not, so the creation time of the dump is the anchor. If the error log is not readable or has already rotated, the reason stays
Unknown; file, time and size are still returned.
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string | Optional | local computer name | SQL Server instance. |
| -SqlCredential | PSCredential | Optional | — | Optional SQL login. |
| -Days | int | Optional | 365 | Only dumps of the last N days. 0 returns all. |
| -MaxLogFiles | int | Optional | 20 | How many error log files (current plus archives) are searched for the reason. |
| -EnableException | switch | Switch | $false | Throw instead of logging. |
Needs VIEW SERVER STATE for the dump list and sysadmin for the reason (xp_readerrorlog). SQL Server 2008 R2 SP1 or later.
Return Value
OnePSCustomObject per dump, newest first: SqlInstance, ProductVersion, FileName, Path, CreationTime, SizeMB, Type, Reason, ErrorNumbers, ExceptionCode, ExceptionAddress, Module, Spid, InputBuffer, ErrorLogNumber, ErrorLogTime, Evidence (the key error log lines) and Hint.
Type is one of Assertion, AccessViolation, NonYieldingScheduler, DeadlockedSchedulers, StackOverflow, OutOfMemory, LatchTimeout, Corruption, WorkingSetTrimmed, Manual (for example DBCC STACKDUMP, not a crash) or Unknown.
Execution Flow
Examples
All dumps of the last year with their reason
Get-sqmMemoryDump -SqlInstance "SQL01"
The last 30 days, one block per dump
Get-sqmMemoryDump -SqlInstance "SQL01" -Days 30 |
Format-List FileName, CreationTime, SizeMB, Type, Reason, Hint
Which kinds of dumps occur most often
Get-sqmMemoryDump -SqlInstance "SQL01" | Group-Object Type | Sort-Object Count -Descending