Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

What does DBCC SHRINKFILE do?

Asked by Coleman Garvin Mar 17, 2023 634 views 1 answer
Share

About this question

 I have a database which is 11TB in size. I recently truncated over 5TB of data from this database.


(I am fully familiar with all the reasons why you would not normally shrink a database please)


I'm curious about what the DBCC SHRINKFILE command is actually doing because when I run the command to shrink a file which is about 650000 MB in size with 45% free space it doesn't seem to actually move any pages around.


The code in question is:


USE [CAF] 
GO 
DBCC SHRINKFILE (N'FILENAME' , 650239) 
GO
When I monitor the performance metrics of the server on executing DBCC SHRINKFILE I see the following

Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.