Monday, February 20, 2012

NDFs into MDF

Hi,
One simple question. I have a DB with MDF+NDFs files and I want to restore/create
its backup to a DB with only one MDF file.
How?
Thanks,
PS: My INET does not allow me any domains but MS. So, if your solution points to
links outside MS, please copy the content in the message.A restored database is exactly like the original. The number and size of
the files will be the same after the restore.
You can consolidate the data files after the restore by executing DBCC
SHRINKFILE ... EMPTYFILE on the 'ndf' file. This will migrate data pages
from the secondary data file to the primary data file. You can remove the
secondary file afterward with ALTER DATABASE REMOVE FILE.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Ian Hughes" <anonymous@.discussions.microsoft.com> wrote in message
news:27B711FB-6AF6-4D26-9333-9C68CACF41D6@.microsoft.com...
> Hi,
> One simple question. I have a DB with MDF+NDFs files and I want to
restore/create
> its backup to a DB with only one MDF file.
> How?
> Thanks,
> PS: My INET does not allow me any domains but MS. So, if your solution
points to
> links outside MS, please copy the content in the message.|||Dan's answer assumes he's got multiple files in the same filegroup. if he's
got multiple filegroups and objects in those filegroups then i think the only
option is to go into each object and move it to the primary filegroup. once
the secondary filegroup is emptied, then the file(s) for that filegroup can be
deleted.
Dan Guzman wrote:
> A restored database is exactly like the original. The number and size of
> the files will be the same after the restore.
> You can consolidate the data files after the restore by executing DBCC
> SHRINKFILE ... EMPTYFILE on the 'ndf' file. This will migrate data pages
> from the secondary data file to the primary data file. You can remove the
> secondary file afterward with ALTER DATABASE REMOVE FILE.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Ian Hughes" <anonymous@.discussions.microsoft.com> wrote in message
> news:27B711FB-6AF6-4D26-9333-9C68CACF41D6@.microsoft.com...
> > Hi,
> > One simple question. I have a DB with MDF+NDFs files and I want to
> restore/create
> > its backup to a DB with only one MDF file.
> > How?
> > Thanks,
> > PS: My INET does not allow me any domains but MS. So, if your solution
> points to
> > links outside MS, please copy the content in the message.

No comments:

Post a Comment