Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 move tables to another datafiles?

Author  Topic 

ann06
Posting Yak Master

171 Posts

Posted - 2009-04-18 : 09:07:51
Hi guys,
i have a database (which i inherited)with very big size and increasing with time. its created on primary filegroup with two data files mdf and ldf.
after sometime the harddisk will be out of space and i want to make a plan to add a new harddisk but how can i split the database to span the two drives?
i want to move some tables to the secondary file which will be on the other HDD.
what is the procedure to do this?

Thanks for the team

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-04-19 : 01:26:41
Create new filegroup with files and put it in New HDD. Then if table has clustered index, you can move the huge table to that FG.Otherwise you will have to create clustered index if not.
Go to Top of Page

ann06
Posting Yak Master

171 Posts

Posted - 2009-04-19 : 09:27:55
by using only alter table i can move existing tables to the new filegroup? even if the table has recods?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-19 : 10:26:15
Yes.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-04-19 : 11:58:02
quote:
Originally posted by ann06

by using only alter table i can move existing tables to the new filegroup? even if the table has recods?



You can move clustered index to different FG with index properties. That will move whole table to new FG as well.
Go to Top of Page

ann06
Posting Yak Master

171 Posts

Posted - 2009-04-26 : 05:17:27
some tables don't have clustered index should i create to move the tables to the new HDD no other way?
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-04-26 : 06:12:18
quote:
Originally posted by ann06

some tables don't have clustered index should i create to move the tables to the new HDD no other way?


Using clustered index to move table is a good hack.

You ask for another way?
http://support.microsoft.com/kb/224071/en-us

Webfred


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -