search cancel

Shrinking the database filegroups manually


Article ID: 230613


Updated On:


Data Center Security Server Advanced Critical System Protection


Commands to shrink database manually.


Following can be performed to shrink the partition.

  • Run the below command for the partition files which are consuming GB's of space.
          EXEC sp_helpfile
  • Run the below command to check the time stamp of the partition

         select top 1 * from CSPEVENT with (NOLOCK) where event_dt_day_of_Yr = <Partition number>

  • Run the query to find the number of events in particular partition
    select count from CSPEVENT with (NOLOCK) where event_dt_day_of_Yr = <Partition number>
  • Once confirmed that events are zero, then ran the below command to shrink the partition.
          dbcc shrinkfile (<PartitionName>, target_size)
          Note : Target_size is in MB
  • The Partition got shrinked successfully and the disk space was reclaimed.