Determine who and what Caused a Deadlock in one of your Database Objects

Determine who and what Caused a Deadlock in one of your Database Objects

It is relatively simple to establish what has caused a deadlock in one of your database objects. All you need to do is to know how to manipulate the built in System databases in order to get the appropriate information.

The following Query:

SELECT  SysTL.request_session_id,     DB_NAME(SysTL.resource_database_id),    SysO.Name,     SysP.object_id,     SysTL.resource_type,     SysTL.request_mode,    SysSQLT.text,            SysES.login_name,    SysES.host_name,    SysST.is_user_transaction,,    SysCN.auth_scheme FROM    sys.dm_tran_locks SysTL    JOIN sys.partitions SysP ON SysP.hobt_id = SysTL.resource_associated_entity_id    JOIN sys.objects SysO ON SysO.object_id = SysP.object_id    JOIN sys.dm_exec_sessions SysES ON SysES.session_id = SysTL.request_session_id    JOIN sys.dm_tran_session_transactions SysST ON SysES.session_id = SysST.session_id    JOIN sys.dm_tran_active_transactions SysAT ON SysST.transaction_id = SysAT.transaction_id    JOIN sys.dm_exec_connections SysCN ON SysCN.session_id = SysES.session_id    CROSS APPLY sys.dm_exec_sql_text(SysCN.most_recent_sql_handle) AS SysSQLTWHERE   resource_database_id = db_id()ORDER BY L.request_session_id

Determines which user has caused the lock, on what object is the lock, as well as all associated transactions in the current query?s feed???even the SQL text that is busy executing

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as