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
Leave A Comment?