oracle11g - Bulk update of column values of entire table -
we have oracle 11g database table around 35 million rows. in situation have update values of 1 column. column indexed.
i have script can generate updated values , can populate in text file.
i'm looking strategy bulk update table. can afford downtime of around 10 hours.
will idea to
- dump entire table flat file
- update values using scripting language
- reload entire table
- rebuild indexes
what pitfalls 1 can encounter?
i'm not competent in pl/sql. there way solve in pl/sql or way "within" database itself?
thanks, prabhu
the fastest way create external table based on flat file of update values , then:
create table new_table select o.col1, o.col2, o.col3, ..., x.value coln old_table o join extern_table x on ...;
(make sure join returns rows old_table. join may need outer join.)
-- drop foreign key constraints reference old_table alter table child1 drop constraint fk_to_old_table1; ... drop table old_table; rename new_table old_table; -- re-create indexes , constraints on old_table alter table old_table add constraint oldpk primary key (col1); ... -- re-create dropped foreign key constraints old_table alter table child1 add constraint fk_to_old_table1 ...; ...
Comments
Post a Comment