Created
March 7, 2026 12:53
-
-
Save paschott/80d0303b62d13072e539bf09a818ac50 to your computer and use it in GitHub Desktop.
TSQL Backup and Restore Status
This file contains hidden or 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 *1.0 as percent_complete, | |
| dateadd(second,estimated_completion_time/1000.0, 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','RESTORE DATABASE','BACKUP LOG','RESTORE LOG') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment