Technical Article

Wait Time - Query\Client

,

1º - Create table

2º - Insert into on table

--------------------------------------------------------------------------
-- Creation date: 14/10/2011
-- Owner: Wellington A. Vitoriano (WellingtonSQL\DocTom)
-- Personal: wellington_sql@hotmail.com
-- MSN: doctom22@hotmail.com
--------------------------------------------------------------------------

-- 1º step
CREATE TABLE WAIT 
(
sessao int,
origem varchar (30),
tipoespera varchar(50),
Destino varchar(20),
Ult_Leitura smalldatetime, 
Ult_Escrita smalldatetime, 
comando text
)
GO
-- 2º step
INSERT INTO WAIT 
SELECT
s.session_id [Sessao],
s.host_name [Origem],
r.last_wait_type [TipoEspera],
C.local_net_address [Destino],
c.last_read [Ult. Leitura],
c.last_write[Ult. Escrita],
T.text
FROM sys.dm_exec_connections c
CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) AS T
INNER JOIN sys.dm_exec_sessions s 
ON s.session_id = c.session_id
INNER JOIN sys.dm_exec_requests r
ON s.session_id = r.session_id
WHERE r.last_wait_type = 'ASYNC_NETWORK_IO' --Selecionar o tempo de espera
GO
-- 3º step
SELECT * FROM WAIT

Rate

2.4 (5)

You rated this post out of 5. Change rating

Share

Share

Rate

2.4 (5)

You rated this post out of 5. Change rating