采用不写日志及使用Hint提示减少数据操作的时间。建议方案是先修改表为不写日志: sql> alter table table_name NOLOGGING; 插入数据:INSERT /*+Append*/ INTO tab1 SELECT * FROM tab2;插入完数据后,再修改表写日志: sql> alter table table_name LOGGING; Oracle 插入大量数据 http://blog.csdn.net/tianlesoftware/archive/2009/10/30/4745144.aspx ------------------------------------------------------------------------------ Blog: http://blog.csdn.net/tianlesoftware 网上资源: http://tianlesoftware.download.csdn.net 相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx DBA1 群:62697716(满); DBA2 群:62697977(满) DBA3 群:63306533; 聊天 群:40132017
insert /*+append*/ into b select from a commit;insert /*+append*/ into c select from a commit;insert /*+append*/ into d select from a commit;
顶2楼的,不过楼主的意思没有完全理解, b,c,d 表分别各插入1亿条 还是各插入3亿条。
如果被插入的表为空,则 create table b as select * from a where ... create table c as select * from a where ... create table d as select * from a where ...
建表和insert时都可以指定nologging。 create table d nologging as select * from 表; insert into d nologging select * from 表;
insert into b select /*+parallel(a,4)*/ *from a ;
我来换一种思路,用 impdp 导入是否更快。在有备份文件的情况下。
append + nolog+ parallel 是最快的
我觉得如果b,c,d表如果不能锁太久的话 可以先建三张临时表 ,把a中的数据分别存储,然后再从三张表中分别insert into select * from 这样貌似锁表的时间会短一些
PCTAS可以说是最高的了。如果你的A表按照了你的要求分区,那么,如果A表的数据可以不要了,那么exchange partition是最最快的。秒级啊。如果A表的数据还要,就使用CTAS吧。如果b c d表是新建的表。如果b c d表原来就有数据,那只有paralle+append+nologging
采用不写日志及使用Hint提示减少数据操作的时间。建议方案是先修改表为不写日志:
sql> alter table table_name NOLOGGING; 插入数据:INSERT /*+Append*/ INTO tab1
SELECT * FROM tab2;插入完数据后,再修改表写日志:
sql> alter table table_name LOGGING; Oracle 插入大量数据
http://blog.csdn.net/tianlesoftware/archive/2009/10/30/4745144.aspx
------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
网上资源: http://tianlesoftware.download.csdn.net
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
DBA1 群:62697716(满); DBA2 群:62697977(满)
DBA3 群:63306533; 聊天 群:40132017
commit;insert /*+append*/ into c select from a
commit;insert /*+append*/ into d select from a
commit;
create table b as select * from a where ...
create table c as select * from a where ...
create table d as select * from a where ...
create table d nologging as select * from 表;
insert into d nologging select * from 表;