Kill process on MS SQL

#FIND ALL PROCESSES

SELECT getdate() as “RunTime”, st.text, qp.query_plan, a.* FROM sys.dm_exec_requests a CROSS APPLY sys.dm_exec_sql_text(a.sql_handle) as st CROSS APPLY sys.dm_exec_query_plan(a.plan_handle) as qp order by CPU_time desc

#ABOVE QUERY WILL LIST ALL ITEMS WITH DATABASE ID AND TO FIND THE DATABSE NAME USE BELOW ONE

SELECT name as Database_Name, database_id as Database_ID
FROM sys.databases;

#KILL QUERIS BASED ON SESSION_ID. Session_ID will also be listed from first query

KILLĀ  SESSION_ID ( eg. KILL 53 )

facebooktwittergoogle_plusredditpinterestlinkedinmail

LEAVE A COMMENT