Melih wrote:
> Hi All,
> Is it possible to change db file to single file from multiple files?
> Thanks any help
> Melih
Look up DBCC SHRINKFILE, particularly the EMPTYFILE clause.Melih,
Sure, you can remove a file from a filegroup when it is empty, using "alter
database". To empty the file use "DBCC SHRINKFILE(file_name | fiel_id,
EMPTYFILE)", it move the data to others files in the filegroup and mark it s
o
no more data is added to it.
Example:
use northwind
go
alter database northwind
add file (name=northwind_2,filename='c:\temp\nort
hwind_data_2.ndf',size=512K
B)
go
-- not needed in this case because it is empty
dbcc shrinkfile(northwind_2, EMPTYFILE)
go
alter database northwind
remove file northwind_2
go
AMB
"Melih" wrote:
> Hi All,
> Is it possible to change db file to single file from multiple files?
> Thanks any help
> Melih|||Hi All,
Is it possible to change db file to single file from multiple files?
Thanks any help
Melih|||Melih wrote:
> Hi All,
> Is it possible to change db file to single file from multiple files?
> Thanks any help
> Melih
Look up DBCC SHRINKFILE, particularly the EMPTYFILE clause.|||Melih,
Sure, you can remove a file from a filegroup when it is empty, using "alter
database". To empty the file use "DBCC SHRINKFILE(file_name | fiel_id,
EMPTYFILE)", it move the data to others files in the filegroup and mark it s
o
no more data is added to it.
Example:
use northwind
go
alter database northwind
add file (name=northwind_2,filename='c:\temp\nort
hwind_data_2.ndf',size=512K
B)
go
-- not needed in this case because it is empty
dbcc shrinkfile(northwind_2, EMPTYFILE)
go
alter database northwind
remove file northwind_2
go
AMB
"Melih" wrote:
> Hi All,
> Is it possible to change db file to single file from multiple files?
> Thanks any help
> Melih
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment