Restore database

  • I have a database that is made up of 4 data files.  I have a complete backup and want to restore it to a new

    environment that has a database with 1 data file, how do I do this?

     

    Thanks,

    Kevin

  • You'll have to restore it with all 4 files.

    Then, you'll need to use the DBCC SHRINKFILE command with the EMPTYFILE option to move all the data out of the file you wish to remove.  You'll have to keep the primary file, so don't use this command on it!  The EMPTYFILE option tells SQL not to allow data to be written to the file, and you can't remove the primary file.  After all the data has been moved to the primary file, then you can use the ALTER DATABASE command to remove the extra files. 

    Steve

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

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