Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. SELECT command,
  2. sh.text,
  3. start_time,
  4. percent_complete,
  5. CAST(((DATEDIFF(s,start_time,GetDate()))/3600) as varchar) + ' hour(s), '
  6. + CAST((DATEDIFF(s,start_time,GetDate())%3600)/60 as varchar) + 'min, '
  7. + CAST((DATEDIFF(s,start_time,GetDate())%60) as varchar) + ' sec' as running_time,
  8. CAST((estimated_completion_time/3600000) as varchar) + ' hour(s), '
  9. + CAST((estimated_completion_time %3600000)/60000 as varchar) + 'min, '
  10. + CAST((estimated_completion_time %60000)/1000 as varchar) + ' sec' as est_time_to_go,
  11. dateadd(second,estimated_completion_time/1000, getdate()) as est_completion_time,
  12. status, blocking_session_id, wait_type, wait_time, last_wait_type, wait_resource, reads, writes, cpu_time
  13. FROM sys.dm_exec_requests re
  14. CROSS APPLY sys.dm_exec_sql_text(re.sql_handle) sh
  15. WHERE re.command in ('RESTORE DATABASE', 'BACKUP DATABASE', 'RESTORE LOG', 'BACKUP LOG')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement