This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a DBA Script for checking the status of running backup in SQL Server.
I already shared different types of DBA Scripts on SQL Database Backup and Restore. Because the Database Backup and Restore is a primary task for any SQL DBA.
SQL Server: Script to find Last Backup Time for All Databases
SQL Server: Script to find Estimated Finish Time of The Backup Database
Using the below script, you can find the status of running database backup:
1 2 3 4 5 6 7 8 9 10 11 |
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 |
Leave a Reply