阿仁's Blog

檢查 SQL Server Restoring 的進度

| Comments

SQL Server Restore 時,有時候檔案很大不知道到底做到哪裡了,
這時可以使用下面這個指令,查詢 SQL Server Restore 的進度。

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')

Reference

https://www.mssqltips.com/sqlservertip/2343/how-to-monitor-backup-and-restore-progress-in-sql-server/

Comments

comments powered by Disqus