Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving multipl;e data files to one file. 1

Status
Not open for further replies.

siituser

Programmer
Sep 30, 2002
67
0
0
CA
One of our datatbases (SQL Server 2000) has 4 data files that are limited to 2 Gigs each. There are also 2 transaction log files. I'm planning on moving the database to a different server and I'd like to combine the 4 data files into one that will grow automatically.

I can not seem to find a wizard or instructions on how I would do that in Enterprise Manager.

Can someone point me in the right direction?

Thank you.

 
The only way in EM is to manually change the Filegroup for each table (you could create a new filegroup with a single file). This could be very laborious if you have a lot of tables!

Is there a specific reason why you want to delete 3 of the files? Was there a reason for having 3 files?

In a production DB, it is probably not advisable to use AutoGrow as this can lead to fragmentation of your datafiles & hurt performance. You are better off manually growing the datafile, allowing plenty of growth each time (such as 6 months or more).

James Goodman MCSE, MCDBA
 
You will need to empty each data file then delete it, one at a time. Good luck!

DBCC SHRINKFILE(DataFile, EMPTYFILE)
GO
ALTER DATABASE DatabaseName
REMOVE FILE DataFile


--John [rainbow]
-----------------------------------
Behold! As a wild ass in the desert
go forth I to do my work.
--Gurnie Hallock (Dune)
 
Arg. I don;t really have a reason for the multiple files except to say that a third party company set up the database that way. The reason I want to go back to one file is that it makes it much easier to back up the data and restore it to our backup production environment and our dev server. Everytime this company adds a new file, all the jobs fail. To many fingers in the pie...

Thanks for the info - I'll give it a try and will not auto grow the file sizes.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top