Skip to content

Instantly share code, notes, and snippets.

@akramarev akramarev/sql-progress.sql
Last active Jul 21, 2019

Embed
What would you like to do?
[Print out long running mssql backup/restore queries]
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
You can’t perform that action at this time.