How to check status of running SQL Server Database Backup
DBAs
often need to monitor the status of backup or restore task which
running on the server. The script below, which I created by combining many
online commands, can give us a summary of the backups and restores that are now
running on the server.
SELECT
A.NAME AS DatabaseName
,B.TOTAL_ELAPSED_TIME/60000 AS Running
,B.ESTIMATED_COMPLETION_TIME/60000 AS Remaining
,B.PERCENT_COMPLETE
,(SELECT TEXT FROM sys.dm_exec_sql_text(B.SQL_HANDLE)) AS SQLCommand
FROM MASTER..SYSDATABASES A,
sys.dm_exec_requests B
WHERE A.DBID=B.DATABASE_ID
AND B.COMMAND
LIKE '%BACKUP%'
ORDER BY
B.PERCENT_COMPLETE DESC
,B.TOTAL_ELAPSED_TIME/60000 DESC
0 Comments