Equally distribute data in Secondary File within a File Group

This is a really a pain job.The Primary Data file has grown out of proportion and reached to the drive limit.Adding a new data file (secondary file.ndf) will only be used for new allocation of data or index pages. Then how to equally distribute data between the primary and secondary files , I have read lot of blog post but nothing actually helped me.  Eventually I thought to REBUIL all indexes with fill factor

 

Print 'Rebuilding indexes on every table in the database.' 
EXEC sp_MSforeachtable @command1="print 'Rebuilding indexes for ?' ALTER INDEX ALL ON ? REBUILD WITH (FILLFACTOR = 90)" 
GO

image

Leave a Reply

Your email address will not be published. Required fields are marked *