官方文章內容 - System_Health 所收集的資訊
透過之前筆記 - [SQL] 模擬死結產生 來產生死結,並在擴充事件內觀察 DeadLock,以下為 SSMS 操作步驟
- The sql_text and session_id for any sessions that encounter an error that has a severity >= 20.
- The sql_text and session_id for any sessions that encounter a memory-related error. The errors include 17803, 701, 802, 8645, 8651, 8657 and 8902.
- A record of any non-yielding scheduler problems. These appear in the SQL Server error log as error 17883.
- Any deadlocks that are detected, including the deadlock graph.
- The callstack, sql_text, and session_id for any sessions that have waited on latches (or other interesting resources) for > 15 seconds
- The callstack, sql_text, and session_id for any sessions that have waited on locks for > 30 seconds.
- The callstack, sql_text, and session_id for any sessions that have waited for a long time for preemptive waits. The duration varies by wait type. A preemptive wait is where SQL Server is waiting for external API calls.
- The callstack and session_id for CLR allocation and virtual allocation failures.
- The ring buffer events for the memory broker, scheduler monitor, memory node OOM, security, and connectivity.
- System component results from sp_server_diagnostics.
- Instance health collected by scheduler_monitor_system_health_ring_buffer_recorded.
- CLR Allocation failures.
- Connectivity errors using connectivity_ring_buffer_recorded.
- Security errors using security_error_ring_buffer_recorded.
透過之前筆記 - [SQL] 模擬死結產生 來產生死結,並在擴充事件內觀察 DeadLock,以下為 SSMS 操作步驟
SELECT
-- DeadLock XML 內容
CONVERT(xml,event_data).query('/event/data/value/deadlock') as DeadLockGraph ,
-- 直接抓 DeadLock XML 內的 timestamp
CONVERT(xml, event_data).value('(event[@name="xml_deadlock_report"]/@timestamp)[1]','datetime') AS Execution_Time ,
-- timestamp_utc 欄位資訊在 SQL Server 2017 才開始提供
timestamp_utc
FROM sys.fn_xe_file_target_read_file('system_health*.xel', null, null, null)
WHERE [object_name] = 'xml_deadlock_report'
ORDER BY timestamp_utc DESC
sys.fn_xe_file_target_read_file 抓出來的 DeadLock XML 檔案,另存為 xdl 後,再利用 SSMS 開啟,就可以看見 DeadLock Graph
![[SQL] 透過擴充事件來捕捉 DeadLock-1](https://live.staticflickr.com/65535/50547813357_e392f409bb.jpg)
![[SQL] 透過擴充事件來捕捉 DeadLock-2](https://live.staticflickr.com/65535/50547676576_f532809865_z.jpg)
![[SQL] 透過擴充事件來捕捉 DeadLock-4](https://live.staticflickr.com/65535/50547676621_3b2dab363e_z.jpg)
![[C#] 以系統管理員身分執行此程式-1](https://live.staticflickr.com/65535/50518391058_5af0c73f0a_z.jpg)
![[C#] 以系統管理員身分執行此程式-3](https://live.staticflickr.com/65535/50518391038_c527a8e5ef_n.jpg)
![[C#] 以系統管理員身分執行此程式-2](https://live.staticflickr.com/65535/50518391033_1fd513cacb.jpg)


![[C#] BackgroundWorker - Exception](https://live.staticflickr.com/65535/50504853112_83f673e818_m.jpg)
![[C#] 利用 ZipFile 進行壓縮與解壓縮-1](https://live.staticflickr.com/65535/50503465518_b9603a2fc9_z.jpg)






![[Hyper-V]vmcx 刪除-1](https://live.staticflickr.com/65535/50466908338_6543923ed1.jpg)
![[Hyper-V]vmcx 刪除-2](https://live.staticflickr.com/65535/50467766197_3e7e47533a_z.jpg)
