Top 10 sesiuni ce incarca CPU

Configurare noua (How To)

Situatie

Mai jos este o procedura ce returneaza top 10 sesiuni care incarca cel mai mult procesorul si, ca informatii suplimentare, se returneaza spid-ul sesiunii, ce anume ruleaza, login time-ul,  program name.

Solutie

create procedure Top10LoadCpu_prc

as

select
top 10
t.text ,
sp.spid,
sp.cpu,
sp.login_time,
sp.last_batch,
sp.hostname,
sp.cmd,
sp.program_name,
sp.loginame

from sys.sysprocesses sp
CROSS APPLY sys.dm_exec_sql_text(sp.sql_handle) AS t
where spid > 50
order by cpu desc

Tip solutie

Permanent

Voteaza

(23 din 44 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?