Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Database Shrinking and EMPTYFILE

$
0
0

Hello Everyone,

I've read all over the place that shrinking a database will cause fragmentation. I am just trying to get this straight in my head. Does the fragmentation only occur in the indexes on that particular database that is being shrunk? I understand that once a database is shrunk a reorganization or rebuild of the indexes is necessary to defragment the database again, this also causes growth as well.


Question on the Index rebuild and reorganization growth:
Lets say the Database i have is a 500GB SharePoint Content Database and i do some externalization via storage point to rip the BLOBs out of that database and throw them into a CIFS share. Obviously a large percentage of my database space will have been cleared out at that point. Will shrinking the database and then reorganizing or rebuilding the indexes grow the file by the same amount as i just shrank the database by? My intuition tells me no it won't but it will grow a little bit as space is needed to rebuild or reorganize those indexes.


Question on Shrinking using the EMPTYFILE
Every once in a while we run out of space on a SQL disk, i understand this shouldnt happen, but it does. In those cases my databases are still growing and i have to create extra NDF files on another drive. My question is if i was to get more space on the original drive is it ok to use the EMPTYFILE option with the DBCC SHRINKFILE command? I am assuming this causes fragmentation as well so a rebuild or reorganize of my index would need to take place. Depending on how much space im going to be gaining by moving files back to whitespace left in the original NDFs it may be worth it. I am just looking for caveats in using EMPTYFILE.

Thank you very much in advance.

LittleTech


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>