0

I have a database in a single file group, with a single file group. I've added 7 data files to this file group. Is there a way to rebalance the data over the 8 data files other than by telling sql server to empty the original? If this is the only way, is it possible to allow sql server to start writing to this file? MSDN says that once its empty its marked so no new data will be written to it.

What I'm aiming for is 8 equally balanced data files.

I'm running SQL Server 2005 standard edition.

Thanks

1 Answer 1

0

Rebuild your indexes:

exec sp_MSforeachtable 'alter index all on ? rebuild';
2
  • Will that distribute the tables across the files as well? or just the indexes?
    – Blootac
    Apr 26, 2010 at 18:11
  • It will redistribute data for all indexes, including the clustered index, which is what one usually calls the 'table'. For heaps (tables w/o a clustered index) things are more complex in SQL 2005 (you need to copy the data). In SQL 2008 you can use ALTER TABLE ... REBUILD for heaps. Apr 26, 2010 at 20:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .