SELECT 
       percent_complete, 
       start_time, 
       status, 
       command, 
       estimated_completion_time, 
       DATEADD(ms,estimated_completion_time,GETDATE()) AS EstimatedEndTime, 
       cpu_time, 
       total_elapsed_time
FROM 
	sys.dm_exec_requests
SP_WHO
SP_WHO2

Examples:

SELECT 
       percent_complete, 
       start_time, 
       status, 
       command, 
       estimated_completion_time, 
       cpu_time, 
       total_elapsed_time
FROM sys.dm_exec_requests
where command like '%DBCC%'
SELECT  
	session_id,
	request_id,
	percent_complete,
	estimated_completion_time,
	DATEADD(ms,estimated_completion_time,GETDATE()) AS EstimatedEndTime, 
	start_time,
	status,
	command,
	database_id,
	cpu_time, 
    total_elapsed_time 
FROM sys.dm_exec_requests
	WHERE database_id = 7
SELECT start_time, 
       DATEDIFF(MINUTE, start_time, GETDATE()) elapsed_time_minutes, 
       command, 
       percent_complete, 
       last_wait_type 
FROM sys.dm_exec_requests
WHERE session_id = 56   -- Replace the 55 with your SPID (Session ID)
Last modified: September 2, 2020

Author

Comments

Write a Reply or Comment