USE MASTER
GO
SELECT
convert(nvarchar(22),db_name(database_id))
as [database],
case command
when
'BACKUP DATABASE' then 'DB'
when
'RESTORE DATABASE' then 'DB RESTORE'
when
'RESTORE VERIFYON' then 'DB RESTORE/VERIFYING'
when
'DbccFilesCompact' then 'SHRINKDB'
else
command
end as [tipo],
start_time as [inicio],
dateadd(mi,estimated_completion_time/60000,getdate())
as [termino previsto],
datediff(mi, start_time,
(dateadd(mi,estimated_completion_time/60000,getdate()))) - wait_time/60000 as
[mins restantes],
datediff(mi, start_time,
(dateadd(mi,estimated_completion_time/60000,getdate()))) as [mins totais
(estimado)],
convert(varchar(5),cast((percent_complete)
as decimal (4,1))) as [% completo],
getdate() as [hora atual]
FROM
sys.dm_exec_requests
WHERE
command in
('KILLED/ROLLBACK', 'BACKUP DATABASE','BACKUP LOG','RESTORE DATABASE','RESTORE
VERIFYON', 'DbccFilesCompact', 'CREATE INDEX', 'UPDATE STATISTIC', 'DBCC',
'DBCC TABLE CHECK', 'CREATE XML INDEX')
GO