ITPub博客

首页 > 数据库 > Oracle > 以半个小时为单位,滚动增加和删除表分区 二

以半个小时为单位,滚动增加和删除表分区 二

原创 Oracle 作者:1xian 时间:2009-04-28 14:16:39 0 删除 编辑
以半个小时为单位,滚动增加和删除表分区[@more@]

对于分区的表,如果在表上创建了global index,一段时间之后drop了一个partition,便会遇到如下错误:ORA-01502

创建global index:

create index TEST_MDATE_IDX on test (mdate);

测试:

脚本如下:

#!/bin/bash
a=2;
while (true)
do

log=`sqlplus -s it01271350/it01271350 << EOF

insert into test(agent) select object_name from dba_objects where rownum <$a;

commit;
EOF`;

echo $log;
let a=${a}+1;
sleep 1;
echo "$a is $a";
done;

一个半小时后会报出如下错误:

ORA-01502: index 'IT01271350.TEXT_MDATE_IDX' or partition of such index is in unusable state Commit complete.

解决方法:

创建local index: create index TEST_MDATE_IDX on test (mdate) local;

测试通过。

思考:创建local index可放心的drop partition,truncate data,但是效率方面比global index 如何?望路过的达人为我解惑。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21342557/viewspace-1021395/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: ITpub 的mysql 报错
下一篇: Oracle 单用户模式
请登录后发表评论 登录
全部评论

注册时间:2009-04-15

  • 博文量
    13
  • 访问量
    15890