How can we see blocked process and long running queries.

  • Hi,

    I just want to know in which dmv i can find Blocked Process and second for Long running queries or is there is query for long running queries.

    Regards

    Jagpal singh

  • select blockedusers=count(*) from master.dbo.sysprocesses where blocked <> 0

  • Hi,

    Thaxx for ur reply but i just want to know that blocked processes and blocked users are same thing .

    or i have this query to see blocked processes but it works only with sql 2005.I want to see blocked proccesses on my 2000 server .

    SELECT

    blocked_query.session_id AS blocked_session_id,

    blocked_query.blocking_session_id AS blocking_session_id,

    sql_text.text AS blocking_text,

    waits.wait_type AS blocking_resource,

    Blockedsql_text.Text As Blocked_Text

    FROM sys.dm_exec_requests blocked_query

    INNER JOIN sys.dm_os_waiting_tasks waits ON waits.session_id = blocked_query.session_id

    INNER JOIN sys.dm_exec_connections as Blocking_Query ON blocked_query.blocking_session_id=Blocking_Query.Session_ID

    CROSS APPLY

    (

    SELECT *

    FROM sys.dm_exec_sql_text(Blocking_Query.most_recent_sql_handle)

    ) sql_text

    CROSS APPLY

    (

    SELECT *

    FROM sys.dm_exec_sql_text(blocked_query.sql_handle)

    ) Blockedsql_text

    plz help me

    Thaxxx

    Regards

    Jagpal Singh

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply