现象如下:
SQL> select count(*) from obj$ where owner#=33;  COUNT(*)
----------
       125SQL> select /*+ index(OBJ$) */ count(*) from obj$ where owner#=33;  COUNT(*)
----------
       729
第一个查询是使用了I_OBJ2索引查找,得到的是125,但对OBJ$表做表扫描,结果是729。而且可以肯定OBJ$中的内容是正确的。
请问该如何修复I_OBJ2这个索引?此外,我视图对OBJ$表增加一个索引,但执行时总是出错。
SQL> create index i_obj4 on obj$(owner#, namespace,
  2    remoteowner, linkname, subname)
  3  /
create index i_obj4 on obj$(owner#, namespace,
                       *
ERROR 位于第 1 行:
ORA-00604: ?? SQL ? 1 ????
ORA-00060: ??????????

解决方案 »

  1.   

    使用alter index rebuild I_OBJ2试试
      

  2.   

    写错了,不好意思,呵呵
    alter index I_OBJ2 rebuild;
      

  3.   

    Cause: Your session and another session are waiting for a resource locked by the other. This condition is known as a deadlock. To resolve the deadlock, one or more statements were rolled back for the other session to continue work.Action: Either:Enter a ROLLBACK statement and re-execute all statements since the last commit or
    Wait until the lock is released, possibly a few minutes, and then re-execute the rolled back statements.因为是修改此系统表,可能别的用户在使用.
      

  4.   

    执行alter index I_OBJ2 rebuild时也是报00604错。在执行此命令时,可以确保没有其他人连接使用数据库。
      

  5.   

    只好重装数据库了。
    用dbv检查system表空间的数据文件,发现有一个数据块有错。检查硬盘并无坏块,不知道是什么原因引起的数据快损坏。用dbms_repair包去检查,的确是I_OBJ2的一个数据快损坏了,曾试着将那个块标记为坏块,结果问题更严重,按object_name在dba_objects中查找时出错。