How to change the number of filegroups in a database restore?

  • Say, we have a database containing 4 filegroups. In its restore, I would like to have the database only contain one filegroup.

    What should I do?

    Many thanks for anyinput in advance.

  • You cannot change the structure of a database during a restore. If a DB had 4 filegroups when it was backed up, it will have 4 filegroups when restored.

    Restore the database with all its filegroups

    Move the tables and indexes from the filegroups you want to drop to the filegroup you want to create (CREATE NONCLUSTERED|CLUSTERED INDEX ... WITH DROP_EXISTING)

    Run the alter database statements to remove the extra filegroups.

    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

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

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