SQL Server: Know the progress of a Shrink

When throwing a shrink database to a SQL Server database, there is no evidence of progression, and some important foundations it can lead to some sweats seeing turn the process without knowing exactly where he is.

It is possible via dm_exec_requests of where the process is ongoing. This will give the percentage of completion of the task, and an approximate end date. What is definitely reassuring.

The query to run (adapted from a query found here ) is as follows:

SELECT percent_complete, start_time, status, command, estimated_completion_time, cpu_time, total_elapsed_time 
FROM sys.dm_exec_requests 
Where command = 'DbccFilesCompact'

You will then see your shrink task, with the percentage of completion in the first column.

Leave a Reply