Find and kill a SQL query
The ColdFusion calls to external systems will just hang around FOREVER waiting for a reply, until the server just gives up! This is because like any good application software, it can't really be sure that it "should" be able to terminate any connection it is waiting for in case it is waiting for something really important (maybe a booking receipt, or credit card payment receipt!!). Clearly some will be outside your control, but when a dodgy SQL query has gone ape, you can always kill that on the database and release the ColdFusion thread and everything will return to normal.
Find the session in SQL like so:
select sq.text,r.session_id,r.status,r.command,r.cpu_time,r.total_elapsed_time
from sys.dm_exec_requests r cross apply sys.dm_exec_sql_text(sql_handle) AS sq
Then issue the KILL command.
KILL 59 -- where 59 is the value from session_id.
Find the session in SQL like so:
select sq.text,r.session_id,r.status,r.command,r.cpu_time,r.total_elapsed_time
from sys.dm_exec_requests r cross apply sys.dm_exec_sql_text(sql_handle) AS sq
Then issue the KILL command.
KILL 59 -- where 59 is the value from session_id.
Comments
Post a Comment