70-466 · Question #73
You have a database named database1. Database developers report that there are many deadlocks. You need to implement a solution to monitor the deadlocks. The solution must meet the following requireme
The correct answer is A. an Extended Events session. Extended Events is the best deadlock monitoring solution because it satisfies all three requirements - real-time capture, easy enable/disable via T-SQL, and queryable data targets.
Question
Options
- Aan Extended Events session
- Ba SQL Server Profiler template
- Clog errors by using trace flag 1204
- Dlog errors by using trace flag 1222
How the community answered
(21 responses)- A71% (15)
- B5% (1)
- C5% (1)
- D19% (4)
Why each option
Extended Events is the best deadlock monitoring solution because it satisfies all three requirements - real-time capture, easy enable/disable via T-SQL, and queryable data targets.
Extended Events sessions capture the deadlock_graph event in real time and can be started or stopped with a single ALTER EVENT SESSION T-SQL statement, making them easy to enable and disable. Data is stored in queryable targets such as ring_buffer or event_file, accessible via DMVs like sys.dm_xe_session_targets, satisfying all three stated requirements.
SQL Server Profiler requires a GUI to configure and run, cannot be easily toggled via T-SQL, and does not support querying captured trace data through standard SQL statements.
Trace flag 1204 writes deadlock information to the SQL Server error log in a less detailed format, requires a server restart to enable or disable, and stores data in plain text that is not directly queryable.
Trace flag 1222 logs more detailed deadlock XML to the error log than 1204 but still requires a server restart to toggle and does not support structured querying of the captured deadlock data.
Concept tested: Extended Events session for real-time deadlock monitoring
Source: https://learn.microsoft.com/en-us/sql/relational-databases/extended-events/quick-start-extended-events-in-sql-server
Topics
Community Discussion
No community discussion yet for this question.