本文共 1895 字,大约阅读时间需要 6 分钟。
Oracle 并行原理深入解析及案例精粹
[日期:2012-08-12]
来源:Linux社区
作者:Leonarding
[字体:大 中 小]
3.sqlload并行+直接加载存在索引的表,此时加载会失败,skip_index_maintenance=true参数可以跳过索引维护完成加载,此时索引状态unusable需要手工重建rebuild
create table leo_test_sqlload4 定义一个有主键的表
(
START_TIME date,
END_TIME date,
PROTOCOL varchar(20),
PRIVATE_IP varchar(20),
PRIVATE_PORT varchar(20) constraint pk_leo_test_sqlload4 primary key ,
SRC_IP varchar(20),
SRC_PORT varchar(20),
DEST_IP varchar(20),
DEST_PORT varchar(20)
);
sqlldr userid=ls/ls control=leo_test4.ctl data=leo_test1.data log=leo_test4.log direct=true parallel=true 并行+直接加载
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Aug 9 16:19:25 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL*Loader-951: Error calling once/load initialization 报错:加载初始化参数错误
ORA-26002: Table LS.LEO_TEST_SQLLOAD4 has index defined upon it. 表上有索引定义,所以加载会失败
LS@LEO> select index_name,index_type,status from user_indexes where table_name='LEO_TEST_SQLLOAD4';
INDEX_NAME INDEX_TYPE STATUS
------------------------------ --------------------------- --------
PK_LEO_TEST_SQLLOAD4 NORMAL VALID 现在索引还是有效的
sqlldr userid=ls/ls control=leo_test4.ctl data=leo_test1.data log=leo_test4.log direct=true parallel=true skip_index_maintenance=true;
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Aug 9 16:30:52 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Load completed - logical record count 100. 使用skip_index_maintenance=true跳过索引维护,100行记录成功加载
LS@LEO> select count(*) from leo_test_sqlload4;
COUNT(*)
----------
100
LS@LEO> select index_name,index_type,status from user_indexes where table_name='LEO_TEST_SQLLOAD4';
INDEX_NAME INDEX_TYPE STATUS
------------------------------ --------------------------- --------
PK_LEO_TEST_SQLLOAD4 NORMAL UNUSABLE 加载后索引状态变成unusable需要手工重建rebuild
小结:我们在sqlload工具加载数据时一定要关注表上是否有索引,并且是什么类型的,正像世界万物一样,没有完美的工具,有得必有失,如果提高性能就会索引失效,如果要维护索引的完整性那么就会增加性能开销,我们要做的更加细心、严谨、谦虚,以不变应万变。
转载地址:https://blog.csdn.net/weixin_34759094/article/details/114346292 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!