Skip to content

Instantly share code, notes, and snippets.

@ghotz
Created June 20, 2021 23:16
Show Gist options
  • Save ghotz/1c3a68872dd8b15ebf8ce746b3881944 to your computer and use it in GitHub Desktop.
Save ghotz/1c3a68872dd8b15ebf8ce746b3881944 to your computer and use it in GitHub Desktop.
Get Backup/Restore operations with completion times
SELECT
session_id, command, start_time, percent_complete,
    estimated_completion_time AS estimated_completion_time_ms,
    estimated_completion_time / (1000 * 60) AS estimated_completion_time_min
FROM
sys.dm_exec_requests
WHERE
command IN ('BACKUP DATABASE', 'BACKUP LOG', 'RESTORE DATABASE', 'RESTORE LOG', 'RESTORE HEADERONLY', 'RESTORE FILELISTONLY')
ORDER BY estimated_completion_time;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment