Tuesday, March 27, 2012

dropping datafile from primary filegroup

Is there a way to drop a datafile from the primary
filegroup after running the dbcc shrinkfile
(file_name,emptyfile).
There is a lot of fragmentation in the datafile and the
file is not shrinking. The size of the datafile right now
is 15 gig and no more than 5gig of data is present in the
datafile . After running the above dbcc command the
contents of the file will be moved onto the remaining data
files in the filegroup and allows the file to be dropped .
But this is not he case with the primary
filegroup/datafile and it errors out. Is there any other
way to drop the datafile or shrink the file to reduce the
fragmentationYou can't drop the Primary file or filegroup. But you can run DBCC
DBREINDEX or DBCC INDEXDEFRAG to reduce the fragmentation.
Andrew J. Kelly
SQL Server MVP
"rajeev" <potinenir@.yahoo.com> wrote in message
news:058201c37d6d$22e20190$a401280a@.phx.gbl...
> Is there a way to drop a datafile from the primary
> filegroup after running the dbcc shrinkfile
> (file_name,emptyfile).
> There is a lot of fragmentation in the datafile and the
> file is not shrinking. The size of the datafile right now
> is 15 gig and no more than 5gig of data is present in the
> datafile . After running the above dbcc command the
> contents of the file will be moved onto the remaining data
> files in the filegroup and allows the file to be dropped .
> But this is not he case with the primary
> filegroup/datafile and it errors out. Is there any other
> way to drop the datafile or shrink the file to reduce the
> fragmentation
>sql

No comments:

Post a Comment