Agent Jobs

See Time When Backup Completes

Here’s a quick script you can use to see exactly when ( or estimated time according to sql server ) that a backup, or restore operation will complete. This will give you a good indication of a certain time ( with more precision ) when a backup is set to complete. I use this and incorporate it into various other dependent jobs to execute at or around the time when these operations would finish.

use master;
set nocount on
select
'command' = sder.command
, 'percent_complete' = convert(numeric(6,2),sder.percent_complete)
, 'completion_time' = convert(char, dateadd(n,(sder.estimated_completion_time /60/1000),getdate()), 9) from
sys.dm_exec_requests sder
where
command in ('backup database', 'backup log', 'restore database')
Advertisements

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