Check the progress of the Shrink Database task in SQL Server

Today I had to shrink a database that was about 250GB and had 100GB free space to create some space on the disk. After running the command you are not able to see the progress of the Shrink, and as this can take some time you want to see how the action is proceeding.

To see the progress of the Shrink Database task you can run a query that will give you some information about the task. Run the following Query in a “New Query Window”

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

This will show you the following information: “Percent_complete”, “start_time”, “cpu_time” and some more information. Keep in mind a shrink can take some time!

Comments are closed.