Shrink Database (DbccFilesCompact)

Database -> Right Click -> Tasks -> Shrink -> Database

-- Percent Completed
SELECT 
    d.name,
    percent_complete, 
    session_id,
    start_time, 
    status, 
    command, 
    estimated_completion_time, 
    cpu_time, 
    total_elapsed_time,
	dateadd(second,estimated_completion_time/ 1000, getdate()) as est_completion_time
FROM 
    sys.dm_exec_requests E left join
    sys.databases D on e.database_id = d.database_id
WHERE
    command in ('DbccFilesCompact','DbccSpaceReclaim')

Example:

3 hrs to Shrink 1,100 GB data file to 296 GB.

Last modified: July 31, 2023

Author

Comments

Write a Reply or Comment