Thursday, October 7, 2010

[SQL] Script to estimate backup time

How to estimate the time needed to backup a large database.

1. Trigger you backup first.
2. Run the below script to check the time remaining to complete the backup ( Result will be in minutes)

SELECT command, 'EstimatedEndTime' = Dateadd(ms,estimated_completion_time,Getdate()),'EstimatedSecondsToEnd' = estimated_completion_time / 1000,'EstimatedMinutesToEnd' = estimated_completion_time / 1000 / 60,'BackupStartTime' = start_time,'PercentComplete' = percent_completeFROM sys.dm_exec_requestsWHERE command IN ('BACKUP DATABASE','RESTORE DATABASE')

No comments: