Backup And Restore Remain Time

Saturday, 06 December 2008 18:56 Alex Rosa SQL Server - Scripts
Print
(2 Votes)
User Rating: / 2
PoorBest 
If you execute a BACKUP or a RESTORE using the SQL Server Management Studio (GUI), the percentage completed will be shown on the screen for each 10% completed, ex.: 10%, 20%, 30%.... 

If you need to know, how long does it take?...use the DMVs and a simple SELECT, check the script below.
 

Columns:
START TIME, PERCENT COMPLETED, COMMAND, DATABASE NAME, STIMATED COMPLETION TIME, MINUTES TO FINISH.

USE MASTER
go

SELECT start_time,
       percent_complete
,
       command,
       b
.name AS DatabaseName,
             
-- MASTER will appear here because the database is not accesible yet.
       DATEADD(ms,estimated_completion_time,GETDATE()) AS StimatedCompletionTime,
      (estimated_completion_time/1000/60) AS MinutesToFinish
FROM sys.dm_exec_requests a
INNER JOIN sys.databases b ON a.database_id = b.database_id
WHERE command LIKE '%restore%'
OR command LIKE '%backup%'
AND estimated_completion_time > 0