Display Current Backup/Restore Progress Using DMVs

[code language=”sql”]USE master

SELECT
session_id as SPID,
CONVERT(VARCHAR(50),start_time,100) AS start_time,
percent_complete,
CONVERT(VARCHAR(50),dateadd(second,estimated_completion_time/1000, getdate()),100) as estimated_completion_time,
command, a.text AS Query
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) a
WHERE r.command LIKE ‘BACKUP%’ OR r.command LIKE ‘RESTORE%'[/code]

Share

One comment

  1. [code language=”sql”]USE master

    SELECT
    session_id as SPID,
    CONVERT(VARCHAR(50),start_time,100) AS start_time,
    percent_complete,
    CONVERT(VARCHAR(50),dateadd(second,estimated_completion_time/1000, getdate()),100) as estimated_completion_time,
    command, a.text AS Query
    FROM sys.dm_exec_requests r
    CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) a
    WHERE r.command LIKE ‘BACKUP%’ OR r.command LIKE ‘RESTORE%'[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.