I’m in the middle of a database migration and thought I’d quickly share a script I threw together to show estimated time of completion for a database restore in progress on SQL Server. The script will also show you estimated time for database backups to complete as well.
Please don’t take this script as gospel, the best way to truly know how long restores will take is to actually perform a restore! Remember folks:
Backups are worthless, restores are pricess
estimated_completion_time /60/1000 as estimate_completion_minutes,
DATEADD(n,(estimated_completion_time /60/1000),GETDATE()) as estimated_completion_time
FROM sys.dm_exec_requests where command = 'BACKUP DATABASE' OR command = 'RESTORE DATABASE'
NOTE: Due to the fact this script uses DMV’s, will only work on SQL Server 2005 and higher