18 November,2012 by Jack Vamvas
When observing a DBCC DHRINKDATABASE on the DMV sys.dm_exec_requests command column , you’ll notice different commands appearing.
Step 1 – DbccSpaceReclaim - Prepares for data moves by cleaning up space –e.g deferred allocations and manage empty extents
Step 2 – DbccFileCompact - Adjusting pages beyond the target to before the target.
Step 3 – DbccLOBCompact - LOB data compact
Sometimes it may appear the command is taking a long time. Some reasons may be:
1) If a heap is moved all Non Clustered index physical link references to a record number on a data page need to be updated. If there are large NonClustered Indexes , the Query Processor needs to process all the updates.
2) Analyse for other processes blocking the lock required to move the page SQL Server – Current queries executing on SQL Server
3) Analyse IO subsystem