Wednesday, May 6, 2015

ORA-8104 "This index object %s is being online built or rebuilt."

ORA-8104 "This index object %s is being online built or rebuilt."

occur during if some one manually killed or terminated index rebuild script in half way.

fix
==========
SQL> select i.obj#, i.flags, u.name, o.name, o.type#    from sys.obj$ o, sys.user$ u, sys.ind$ idx, sys.ind_online$ I   where  bitand(i.flags, 512) = 512 and o.obj#=idx.obj# and
          o.owner# = u.user# and idx.obj#=i.obj#;
      OBJ#      FLAGS  NAME     TYPE#
---------- ---------- --------------------------------------------------
    1501151       2563 test user PK_TESTUSER


SQL> show user
USER is "SYS"
SQL> DECLARE
  2  isClean BOOLEAN;
  3  BEGIN
  4  isClean := DBMS_REPAIR.ONLINE_INDEX_CLEAN();
  5  END;
  6  /

PL/SQL procedure successfully completed.

SQL> commit;

Commit complete.

SQL>  select i.obj#, i.flags, u.name, o.name, o.type# 
  from sys.obj$ o, sys.user$ u, sys.ind$ idx, sys.ind_online$ i
  where  bitand(i.flags, 512) = 512 and o.obj#=idx.obj# and
          o.owner# = u.user# and idx.obj#=i.obj#;  2    3    4 

no rows selected

SQL>


execute 

alter index "index_name" rebuild online;
  

2 comments:

  1. For our refer.

    For some busy DB, DBMS_REPAIR.ONLINE_INDEX_CLEAN will failed to be executed ( command executed successfully but in-journal table cannot be released)

    you have to lock the associated table in exclusive mode:

    LOCK TABLE OWNER.TABLE in exclusive mode;

    Meanwhile, open another session to query your "lock table" session which session is locking the table.

    you need to keep killing the FINAL_BLOCK_SESSION until exclusive lock can be acquired.

    ReplyDelete
  2. For our refer.

    For some busy DB, DBMS_REPAIR.ONLINE_INDEX_CLEAN will failed to be executed ( command executed successfully but in-journal table cannot be released)

    you have to lock the associated table in exclusive mode:

    LOCK TABLE OWNER.TABLE in exclusive mode;

    Meanwhile, open another session to query your "lock table" session which session is locking the table.

    you need to keep killing the FINAL_BLOCK_SESSION until exclusive lock can be acquired.

    ReplyDelete