SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Shink file VS Resize


Shink file VS Resize

Author
Message
Michael_O
Michael_O
SSC Eights!
SSC Eights! (986 reputation)SSC Eights! (986 reputation)SSC Eights! (986 reputation)SSC Eights! (986 reputation)SSC Eights! (986 reputation)SSC Eights! (986 reputation)SSC Eights! (986 reputation)SSC Eights! (986 reputation)

Group: General Forum Members
Points: 986 Visits: 235
I have a database of about 325GB with free space ~120GB and we're having drive alerts go off so i need to free some space.
I know that i could possibly shrink this DB which is a bad idea as it causes fragmentation and will end up just growing the database back in no time. Another approach that i have used in the past that has worked faster than shrinking, even on large database, is resizing the database file using the GUI, files tab in database properties.
What i need help with at this time is understanding the difference between shrink and resize, and the pros and cons of resizing. Can't seem to find anything online so thought my gurus here might have an idea.
Thanks in advance!
GilaMonster
GilaMonster
SSC Guru
SSC Guru (919K reputation)SSC Guru (919K reputation)SSC Guru (919K reputation)SSC Guru (919K reputation)SSC Guru (919K reputation)SSC Guru (919K reputation)SSC Guru (919K reputation)SSC Guru (919K reputation)

Group: General Forum Members
Points: 919818 Visits: 48854
Michael_O - Thursday, September 7, 2017 9:57 AM

What i need help with at this time is understanding the difference between shrink and resize

None.
The GUI calls DBCC ShrinkFile or DBCC ShrinkDatabase, depending whether you selected the option to shrink the file or the entire DB.

Can't seem to find anything online


Because resize isn't a thing.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Chris Harshman
Chris Harshman
SSC-Dedicated
SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)

Group: General Forum Members
Points: 38003 Visits: 7166
Depending on where that 120 GB is in your data file, you could potentially be able to use the TRUNCATEONLY functionality of DBCC SHRINKFILE
https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-shrinkfile-transact-sql
This makes it only remove unused pages at the end of the file without reorganizing any other pages.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum









































































































































































SQLServerCentral


Search