SQL Server backup / restore progress
Cl
Claus Munch
Oct 12, 2026 ยท 1 min read
4 views
A little nugget, to show the status of currently running backup/restore tasks on a SQL Server. Just a little scratching of an itch :)
SELECT
r.session_id,
DB_NAME(r.database_id) AS DatabaseName,
r.command,
r.status,
r.start_time,
CAST(r.percent_complete AS decimal(6,2)) AS PercentComplete,
CAST(r.total_elapsed_time / 60000.0 AS decimal(12,2))
AS ElapsedMinutes,
CASE WHEN r.estimated_completion_time > 0
THEN CAST(r.estimated_completion_time / 60000.0 AS decimal(12,2))
END AS EstimatedMinutesRemaining,
CASE WHEN r.estimated_completion_time > 0
THEN DATEADD(
SECOND,
CONVERT(int, r.estimated_completion_time / 1000),
GETDATE()
)
END AS EstimatedCompletionTime,
r.wait_type,
r.wait_time AS CurrentWaitMilliseconds,
r.blocking_session_id,
t.text AS SQLText
FROM sys.dm_exec_requests AS r
OUTER APPLY sys.dm_exec_sql_text(r.sql_handle) AS t
WHERE r.command LIKE N'BACKUP%'
OR r.command LIKE N'RESTORE%'
ORDER BY r.start_time;