Skip to Content

Various queries: see what tasks are running, who is connected, and kill task or user

Estimated Reading Time: 1 Minutes
SELECT
      percent_complete ,
      start_time ,
       status,
      command ,
      estimated_completion_time ,
      cpu_time ,
      total_elapsed_time
FROM
       sys.dm_exec_requests
WHERE
      command = ’DbccFilesCompact’
 
 
 
 
 
USE master ;
GO
EXEC sp_who ;
GO
 
Returns list of all running processes and their SIPD’s
     sp_who2
 
To kill a process
     KILL {SPID}
 
sp_lock
 
 
SELECT *
FROM sys .dm_os_wait_stats
ORDER BY wait_time_ms DESC
GO
 
 
 
SELECT *
FROM sys .dm_os_waiting_tasks
ORDER BY wait_duration_ms DESC
GO
 
 
 
Various queries: see what tasks are running, who is connected, and kill task or user
  • COMMENT