Reply to Re: question about log file size when alter Huge table

Your name:

Reply:


Posted by Erland Sommarskog on 11/01/05 00:47

Gordowey (albertoiriarte@gmail.com) writes:
> I have the next question, and i would like to hear what do you think
> about, and if is there a better solution for "my problem"
>
> here is the question, I have a huge table with 60GB of data (image
> files). The problem happen always when i try to ALTER the structure of
> the table. For example I change a field char(3) to char(4)...the
> sqlserver then performs the "alter table" command...that must be
> something similar than "insert into the new table + drop the actual
> table" and for that I need about 60GB o space for my LOG file, and
> takes hours to complete the operation.

Yup, that's it.

> Is this the only way to alter a single field in my table??

Rather than having ALTER TABLE to all that under the covers, you could do
it your self. The twist is that then you can do the insert in batches,
and truncate the transaction log between the turns. (Simplest is to run
in simple recovery mode if you can.) When you compose the batches, use
the clustered index for the table, else selection of the batches may be
horribly slow.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация