Get Database Backup Progress

Hello!

If you have backups running through jobs you may want to know the progress of the backup and where the backup media is. Script below returns this information for you.

Happy scripting!

SELECT A.NAME
	,B.TOTAL_ELAPSED_TIME / 60000 AS [Running Time]
	,B.ESTIMATED_COMPLETION_TIME / 60000 AS [Remaining]
	,B.PERCENT_COMPLETE AS [%]
	,(
		SELECT TEXT
		FROM sys.dm_exec_sql_text(B.SQL_HANDLE)
		) AS COMMAND
FROM MASTER..SYSDATABASES A
	,sys.dm_exec_requests B
WHERE A.DBID = B.DATABASE_ID
	AND B.COMMAND LIKE '%BACKUP%'
ORDER BY percent_complete DESC
	,B.TOTAL_ELAPSED_TIME / 60000 DESC

 

Author: Richie Lee

Full time computer guy, part time runner. Full time Dad, part time blogger. Pokémon Nut. Writer of fractured sentences. Maker of the best damn macaroni cheese you've ever tasted.

1 thought on “Get Database Backup Progress”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s