Search This Blog

Wednesday, November 18, 2020

How to check progress of backup or restore of database on SQL

Some time in SQL backup or restore database process takes more than the usual time and we are not sure when it will going to be completed. 

you can execute the below query and it will display the current status of it and also the estimated time of completion


SELECT session_id as SPID, command, a.text AS Query, start_time, percent_complete, 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) a 

WHERE r.command in ('BACKUP DATABASE','RESTORE DATABASE')


Result will be as per below.



No comments:

Post a Comment