Friday, March 9, 2012

Primary filegroup

Hi
I have a database with 3 datafiles :
file1 => filegroup primary
file2 => filegroup primary
file3 => filegroup index_data
Now I want to delete the file2. Is that possible ? I get the message that
the file is not empty. How can I determine what data is in the file ?
Regards
Gene
You need to empty it first using DBCC SHRINKFILE with the EMPTYFILE option.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Gene Vangampelaere" <gene.vangampelaere.remove.this@.infohos.remove.thi s.be> wrote in message
news:e5GdaAfVFHA.3716@.TK2MSFTNGP12.phx.gbl...
> Hi
> I have a database with 3 datafiles :
> file1 => filegroup primary
> file2 => filegroup primary
> file3 => filegroup index_data
> Now I want to delete the file2. Is that possible ? I get the message that the file is not empty.
> How can I determine what data is in the file ?
>
> Regards
> Gene
>
|||thx !!!
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> schreef
in bericht news:OyG65IfVFHA.1200@.TK2MSFTNGP14.phx.gbl...
> You need to empty it first using DBCC SHRINKFILE with the EMPTYFILE
> option.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Gene Vangampelaere"
> <gene.vangampelaere.remove.this@.infohos.remove.thi s.be> wrote in message
> news:e5GdaAfVFHA.3716@.TK2MSFTNGP12.phx.gbl...
>
|||Hi,
To do this, use the DBCC SHRINKFILE with EMPTY FILE option for the NDF file
This will empty the file and mark it as unavailable. After this use ALTER
DATABASE.. REMOVE FILE option to remove the NDF file.
Steps:
1. Take a database backup
2. Use database_name
go
DBCCSHRINKFILE('NDFFILE_name',X'EMPTYFILE')
3. Use ALTER database to Remove the file
ALTER DATABASE <DBNAME> REMOVE FILE 'logical ndf file name'
Thanks
Hari
SQL Server MVP
"Gene Vangampelaere" <gene.vangampelaere.remove.this@.infohos.remove.thi s.be>
wrote in message news:e5GdaAfVFHA.3716@.TK2MSFTNGP12.phx.gbl...
> Hi
> I have a database with 3 datafiles :
> file1 => filegroup primary
> file2 => filegroup primary
> file3 => filegroup index_data
> Now I want to delete the file2. Is that possible ? I get the message that
> the file is not empty. How can I determine what data is in the file ?
>
> Regards
> Gene
>

No comments:

Post a Comment