Friday, March 30, 2012

Remove ldf file

Hi all!
I have a SQL Server database with a secondary datafile (*.ndf). I would like to be able to delete that file and only use the *.mdf to store data. Of cource I also have a transaction log file.
Is it possible to move data from the ndf to the mdf and the delete the ndf'
Regards
/FredrikHi,
SQL Server spans data across all data files within a filegroup.So all files
fill will be used for all DMLs. to remove a file , you must first have the
data moved off of the file onto the other members in the data set.
To do this, use the EMPTY FILE parameter in DBCC SHEINKFILE command.
This will empty the file and mark it as unavailable. After that execute
REMOVE FILE in ALTER DATABASE command to drop the NDF file.
See DBCC SHRINKFILE and ALTER database in books online for syntax.
--
Thanks
Hari
MCDBA
"Fredrik" <Fredrik@.discussions.microsoft.com> wrote in message
news:5DCC35E5-43A0-45B7-A3F6-81353A62F09E@.microsoft.com...
> Hi all!
> I have a SQL Server database with a secondary datafile (*.ndf). I would
like to be able to delete that file and only use the *.mdf to store data. Of
cource I also have a transaction log file.
> Is it possible to move data from the ndf to the mdf and the delete the
ndf'
> Regards
> /Fredrik

No comments:

Post a Comment