Rebuilding a databases data

  • kmarshall

    SSC Eights!

    Points: 861

    Hi,

    I am familiar with setting and rebuilding indexes in SQL Server 2000, but I have been asked to investigate how to rebuild the data in a database.

    We have a table that contains an large amount of data. Several new columns have been added to this table and my boss says I will need to rebuild the data as well as the indexes so that it is stored contiguously instead of being scattered all over the place.

    I've had a look through books online and can only come up with references to rebuilding the master database.

    Can anyone point me in the right direction?

    Thanks for your time.

    Regards,

    Kevin.

    Windows 2008 Server | SQL Server 2008

  • Chris Stamey

    SSCrazy

    Points: 2585

    I think if you restore it from a backup it will be contiguous. The question will be, is this feasible.

    Chris

  • bobsterboy

    SSCommitted

    Points: 1539

    I think the easiest way to rebuild the data would be to delete and add a clustered index.  The final result would be data ordered by the clustered index.

  • kmarshall

    SSC Eights!

    Points: 861

    Thanks guys.

    Windows 2008 Server | SQL Server 2008

  • Mark Harr

    SSCrazy Eights

    Points: 9760

    Also, you can use Bulk Export/Import queries on each table and reload all the data.  It's amazing how fast bulk operations are.



    Mark

  • SQLBill

    SSC Guru

    Points: 51440

    It sounds like you boss is talking about DBCC INDEXDEFRAG and DBCC DBREINDEX commands. Check them out in the Books OnLine. -SQLBill

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply