Freeze SQL service manually using WinDbg

Freeze SQL service manually using WinDbg

Currently, the SQL failover cluster works normally.

image-20220606132830651

In the SSMS (Microsoft SQL Server Management Studio), the following query returns the process id and other information related to the SQL server service.

1
2
3
4
-- Thread ID
SELECT kpid,* FROM sys.sysprocesses where program_name like 'Microsoft® Windows® Operating System%'
-- Prrocess ID
SELECT process_id,* FROM sys.dm_server_services WHERE servicename = 'SQL Server (MSSQLSERVER)'

Note that the thread ID here is the id for the system, we need to convert the id before using it.

image-20220606164943627

In WinDbg, attach to the sqlserver.exe process. As you can see, the process id is the same as the query result. Note that make sure the WinDbg is running on the node server that is the current host of the cluster, or you may not find the sqlserver.exe in the list.

image-20220606165000885

Convert the thread ID into hexadecimal, then enter ~~[HEX Thread ID] to get the thread ID (debug ID) in the debugger. Then we can freeze the SQL service by ~Debug ID f.

image-20220606165508820

Now, we observe that the SQL service is frozen.

image-20220606170306322

To resume the service, detach the process from the debugger. Then the SQL server will be brought online.


Freeze SQL service manually using WinDbg
http://example.com/2022/06/06/Freeze SQL service manually using WinDbg/
Author
Jiacheng Xie
Posted on
June 6, 2022
Licensed under