干掉蝴蝶效应中的蝴蝶。。。
分类: Oracle
2013-08-08 23:21:18
1:问题现象
SQL> create index andy.index on andy.tab(name) online nologging parallel 16;
异常中止之后再次创建报错:
ERROR at line 1:
ORA-14451: unsupported feature with temporary table
收集统计信息也报错:
SQL> begin
2 dbms_stats.gather_table_stats(ownname=>'ANDY',tabname=>'TAB',estimate_percent=>100,degree=>16,cascade=>TRUE,no_invalidate=>false);
3 end;
4 /
begin
*
ERROR at line 1:
ORA-20000: this index object "ANDY"."NAME" is being online built or rebuilt
ORA-06512: at "SYS.DBMS_STATS", line 13437
ORA-06512: at "SYS.DBMS_STATS", line 13457
ORA-06512: at line 2
根据index object "ANDY"."NAME"的obj id查看flag:
SQL> select obj#,flags from ind$ where obj#=462180;
OBJ# FLAGS
---------- ----------
462180 256
2:解决办法
SQL> declare
2 isClean boolean;
3 begin
4 isClean := FALSE;
5 while isClean=FALSE loop
6 isClean := dbms_repair.online_index_clean(dbms_repair.all_index_id,dbms_repair.lock_wait);
7 dbms_lock.sleep(2);
8 end loop;
9 exception
10 when others then
11 RAISE;
12 end;
13 /
PL/SQL procedure successfully completed.
SQL>
SQL> select obj#,flags from ind$ where obj#=462180;
no rows selected
SQL>