Do you need to check the progress of your BACKUP/RESTORE?
If your backup (or restore) have been started by another adminitrator or by a job, you cannot use the GUI (or the Messages tab) to follow the progression.
In this case some dynamic management views can be used to track the backup/restore progress:
SELECT command,
s.text,
start_time,
percent_complete,
estimated_completion_time/1000 as "seconds to go",
dateadd(second,estimated_completion_time/1000, getdate()) as "estimated completion time"
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) s
WHERE r.command in ('RESTORE DATABASE', 'BACKUP DATABASE', 'RESTORE LOG', 'BACKUP LOG')
If you are not interested in the command used, the s.text and view dm_exec_sql_text can be removed:
SELECT command,
start_time,
percent_complete,
estimated_completion_time/1000 as "seconds to go",
dateadd(second,estimated_completion_time/1000, getdate()) as "estimated completion time"
FROM sys.dm_exec_requests r
WHERE r.command in ('RESTORE DATABASE', 'BACKUP DATABASE', 'RESTORE LOG', 'BACKUP LOG')
Of course, you can adapt this statement to select more (or less) information.
Hope you like this blog and any comments/suggestions are welcome!
Regards,
Eduardo Rezende
Nice blog. It helped me this morning 😉
Regards, Nicolas
Glad it was helpful! 🙂
Nice one Eduardo.
Regards,
Nick Loy
Thanks Nick!
Nice one
Regards
Ram
Thanks Ram!
Nice blog. It helped me a lot....I was performing a full backup in shared location but did not issue STATS monitoring option in the backup command...
Regards,
GobindaRam Sharma
Hi GobindaRam,
Good to hear this blog was helpful for you! 🙂
Regards,
Eduardo
Hola Eduardo, how this could work in SP11? I am not able to find  DM_EXEC_REQUESTS
SAP DBTech JDBC: [259]: invalid table name: Could not find table/view DM_EXEC_REQUESTS in schema SYS: line 6 col 10 (at pos 200)
muito obrigado!
Hola Joze Lopez,
Which SQL Server version are you using?
Regards,
Eduardo
Hola Joze Lopez,
I just check this query on my SQL Server 2016 environment and I did not face any issue.
Let me know if you need any help.
Best regards,
Eduardo