SQL Server - Predict SQL BACKUP DATABASE finish time with sys.dm_exec_requests

23 August,2012 by Jack Vamvas

Predicting the finish tme of a SQL BACKUP DATABASE command is useful.  The sys.dm_exec_requests    DMV offers some good clues to the finish time.

I was shrinking a  log file (due to long running transaction with no built in COMMITS ) that required some management  but  the command wasn’t executing successfully  , due to a running BACKUP DATABASE command . I needed to know the  percentage finished of the BACKUP DATABASE command

Running this script ,utilising sys.dm_exec_requests    I can see the estimated finish time . I’ve included a sample query , which returns a percent complete and estimated completion.

 

SELECT session_id,percent_complete,DATEADD(MILLISECOND,estimated_completion_time,CURRENT_TIMESTAMP) Estimated_finish_time,
(total_elapsed_time/1000)/60 Total_Elapsed_Time_MINS ,
DB_NAME(Database_id) Database_Name ,command,sql_handle
FROM sys.dm_exec_requests WHERE command LIKE ‘%BACKUP DATABASE%’

 Read More

SQL Server faster restores with instant file initialisation

Display sql backup history for a single database

SQL Server - Display restore history for a single database

 


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on SQL Server - Predict SQL BACKUP DATABASE finish time with sys.dm_exec_requests


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer