首页 > Linux操作系统 > Linux操作系统 > AskTom笔记(2)
last updated 2005-04-04
key word : forall/delete/update
1.
1)forall一次只能执行一个单一的语句,如果有多个insert/delete,必须使用多个forall
2)limit子句使用示例
//other statement
fetch c BULK COLLECT INTO data LIMIT 100;-- 每次100行
begin
FORALL i IN 1 .. data.count SAVE EXCEPTIONS
insert into t2 values data(i);
//other statement
2.
如何删除大表中的大批量的数据
1)
create table new_table unrecoverable as select * from old_table where ....;
drop table old_table;
rename new_table to old_table;
create index old_table_idx1 on old_table(c1,c2) unrecoverable parallel 5;
.....
没有日志产生,只是把数据移动到新表上,drop/rename old/new,而且尽可能快的创建索引
2)
分区表.并行删除数据.每个分区会使用自身的回滚段,会以并行的方式执行.
3)
分区表以便使用DROP分区而不是使用DELETE删除数据.
3.
如何更新大表中的大批量数据
CREATE TABLE new_table as select
index new_table
grant on new table
add constraints on new_table
etc on new_table
drop table old_table
rename new_table to old_table;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/6906/viewspace-21754/,如需转载,请注明出处,否则将追究法律责任。