Sometimes it's very important to know whether Database or log backup or restore is running or not!
in a word, if we need to check the stat/status of a database, we have to run below tSQL. This SQL will show the database names where a backup/restore is running whatever it is DB or LOG backup.
---------------
SELECT r.session_id ,DB_NAME(r.database_id) [Database] ,r.command ,CONVERT(NUMERIC(32, 2), r.percent_complete) [Complete (%)] ,GETDATE() [Current Database Time] ,CONVERT(NUMERIC(32, 2), r.total_elapsed_time / 1000.0 / 60.0) [Running Time (Minute)] ,CONVERT(NUMERIC(32, 2), r.estimated_completion_time / 1000.0 / 60.0) [Required Time (Minute)] ,(select t.text FROM sys.dm_exec_sql_text(sql_handle) t ) 'Statement text' FROM master.sys.dm_exec_requests r WHERE command like 'RESTORE%' or command like 'BACKUP%' |