Last active
July 21, 2019 07:41
-
-
Save akramarev/58d070d2c0c6cd7814fa1fdfd417d1c2 to your computer and use it in GitHub Desktop.
[Print out long running mssql backup/restore queries]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT session_id as SPID, command, a.text AS Query, start_time, percent_complete, dateadd(second,estimated_completion_time/1000, getdate()) as estimated_completion_time | |
FROM sys.dm_exec_requests r CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) a | |
WHERE r.command in ('BACKUP DATABASE','BACKUP LOG','RESTORE DATABASE') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment