Restore from multiple files

  • Hello All,

    Our server it's a bit full and we have to migrate an SQL to a SAN. How can we 'transform' the 4 files that compose the db just to one ?

    Thank you in advance,

    Luis Arnauth

  • What are the four files?

    All databases must have at least two files, an mdf (data) and an ldf (transaction log).  They can also have one or more ndf (additional data, or index) files, and additional ldf files.  There are ways to get rid of the additional ndf and ldf files, but it may not be desirable, depending on the situation.  Basically, to get rid of the extra files, you would use DBCC SHRINKFILE with the EMPTYFILE option.  Once the file is empty, it can be deleted.  But you need to be careful with this.  If you use it on a file that is required to be there (the primary data file), you will render the file unusable, and still not be able to delete it.  You need to ascertain why the database has the additional files, and which ones should, or even can, be deleted.

    Steve

  • Hello,

    Thanks for the answer, but the problem was with the extra mdf files that were created as more phisical disks were placed on the server...

    Now, since we've got a SAN, we just want to move all the data to there, and, into one file.

    I've google it a bit more and found out the aswer... DBCC SHRINKFILE with EMPTYFILE as you said, or via Enterprise manager...

    All the data is in the SAN except the first mdf file created, but that's not a problem since we locked is size growth.

    Anyway thanks again for the answer.

    Luis Arnauth

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

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