ORA-08102之表与索引键值不一致导致带约束关系表不能创建的模拟与解决

##############################################################################################
ORA-08102之表与索引键值不一致导致带约束关系表不能创建的模拟与解决
**********参考老白、note77587.1  edit by sky on 20111023  qq654268465**********
##############################################################################################
********************************************************************************************
模拟的方法是通过修改CON$表中与其索引相关的键值字段CON#,
具体修改的是NAME=_NEXT_CONSTRAINTT对应的CON#,根据CON$表记录生成过程可知修改是正好是最大键值
首先得到con$表中NAME=_NEXT_CONSTRAINTT这条记录所在块的dump
*********************************************************************************************
test:~ # su - oracle
oracle@test:~> sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Sun Oct 23 20:06:50 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select rowid,dbms_rowid.rowid_relative_fno(rowid) rel_fno,
  2  dbms_rowid.rowid_block_number(rowid)blockno,
  3  dbms_rowid.rowid_row_number(rowid) rowno
  4  from con$ where name='_NEXT_CONSTRAINT';

ROWID                 REL_FNO    BLOCKNO      ROWNO
------------------ ---------- ---------- ----------
AAAAAcAABAAAACqAAM          1        170         12

SQL> show parameter udump
SQL> show parameter dump

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
background_core_dump                 string      partial
background_dump_dest                 string      /u01/app/oracle/diag/rdbms/tes
                                                 t/test/trace
core_dump_dest                       string      /u01/app/oracle/diag/rdbms/tes
                                                 t/test/cdump
max_dump_file_size                   string      unlimited
shadow_core_dump                     string      partial
user_dump_dest                       string      /u01/app/oracle/diag/rdbms/tes
                                                 t/test/trace
SQL> host
oracle@test:~> cd /u01/app/oracle/diag/rdbms/test/test/
oracle@test:/u01/app/oracle/diag/rdbms/test/test> rm *.trc
rm: cannot remove `*.trc': No such file or directory
oracle@test:/u01/app/oracle/diag/rdbms/test/test> exit
exit

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@test:~> sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Sun Oct 23 20:09:13 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter system dump datafile 1 block 170;

System altered.

TRACE_FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/test/test/trace/test_ora_9028.trc


***************************************************************************************
修改表中的键值使其与索引中的键值不对应(CON$表与其索引I_CON2的键值为字段CON#)
过程:修改表con$中最大的键值(即为NAME=_NEXT_CONSTRAINT对应的键值CON#=CON#-1)
***************************************************************************************

SQL> select con# from con$ where name like '_NEXT_%'; 

      CON#
----------
     14219
/*查询con#当前值,通过在dump的trace中找02 2b 14,再计算con#所在行的offset*/

------以下是dump
block_row_dump:
tab 0, row 0, @0x1fa5
tl: 19 fb: --H-FL-- lb: 0x0  cc: 4
col  0: [ 1]  80
col  1: [ 8]  53 59 53 5f 43 30 30 33
col  2: [ 2]  c1 04
col  3: [ 1]  80
tab 0, row 1, @0x1f91
tl: 20 fb: --H-FL-- lb: 0x0  cc: 4
col  0: [ 1]  80
col  1: [ 9]  53 59 53 5f 43 30 30 37 31
col  2: [ 2]  c1 48
col  3: [ 1]  80
tab 0, row 12, @0x424
tl: 29 fb: --H-FL-- lb: 0x1  cc: 4
col  0: [ 1]  80
col  1: [16]  5f 4e 45 58 54 5f 43 4f 4e 53 54 52 41 49 4e 54
col  2: [ 4]  c3 02 2b 14
col  3: [ 1]  80
/*也可以p kdbr直接看13行对应的BASE值*/

SQL> select 1060+44+1*24 from dual;

1060+44+1*24
------------
        1128

SQL> shutdown immediate;    /*!!!!!!!!!!!!!!!*/
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@test:~> bbed parfile=bbed.par
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Sun Oct 23 20:14:34 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> set file 1 block 170
        FILE#           1
        BLOCK#          170

BBED> find /c _NEXT_CONSTRAINT
 File: /u01/app/oracle/oradata/test/system01.dbf (1)
 Block: 170              Offsets:  736 to 1247           Dba:0x004000aa
------------------------------------------------------------------------
 5f4e4558 545f434f 4e535452 41494e54 03c30224 01802c00 04018010 5f4e4558
 545f434f 4e535452 41494e54 04c30223 6401802c 00040180 105f4e45 58545f43
 4f4e5354 5241494e 5403c302 2301802c 00040180 105f4e45 58545f43 4f4e5354
 5241494e 5404c302 22640180 2c000401 80105f4e 4558545f 434f4e53 54524149
 4e5403c3 02220180 2c000401 80105f4e 4558545f 434f4e53 54524149 4e5404c3
 02216401 802c0004 0180105f 4e455854 5f434f4e 53545241 494e5403 c3022101
 802c0004 0180105f 4e455854 5f434f4e 53545241 494e5404 c3022064 01802c00
 04018010 5f4e4558 545f434f 4e535452 41494e54 03c30220 01802c00 04018010
 5f4e4558 545f434f 4e535452 41494e54 04c3021f 6401802c 00040180 105f4e45
 58545f43 4f4e5354 5241494e 5403c302 1f01802c 00040180 105f4e45 58545f43
 4f4e5354 5241494e 5404c302 1e640180 2c000401 80105f4e 4558545f 434f4e53
 54524149 4e5403c3 021e0180 2c000401 80105f4e 4558545f 434f4e53 54524149
 4e5404c3 021d6401 2c010401 80105f4e 4558545f 434f4e53 54524149 4e5404c3
 022b0701 802c0004 0180105f 4e455854 5f434f4e 53545241 494e5403 c3022b01
 802c0004 0180105f 4e455854 5f434f4e 53545241 494e5404 c3022a64 01802c00
 04018010 5f4e4558 545f434f 4e535452 41494e54 03c3022a 01802c00 04018010

 <32 bytes per line>

BBED> p 1128
rowdata[0]
----------
ub1 rowdata[0]                              @1128     0x2c

BBED> d /v
 File: /u01/app/oracle/oradata/test/system01.dbf (1)
 Block: 170     Offsets: 1128 to 1639  Dba:0x004000aa
-------------------------------------------------------
 2c010401 80105f4e 4558545f 434f4e53 l ,....._NEXT_CONS
 54524149 4e5404c3 022b1401 802c0004 l TRAINT.+...,..
 0180105f 4e455854 5f434f4e 53545241 l ..._NEXT_CONSTRA
 494e5403 c3022b01 802c0004 0180105f l INT.+..,....._
 4e455854 5f434f4e 53545241 494e5404 l NEXT_CONSTRAINT.
 c3022a64 01802c00 04018010 5f4e4558 l *d..,....._NEX
 545f434f 4e535452 41494e54 03c3022a l T_CONSTRAINT.*
 01802c00 04018010 5f4e4558 545f434f l ..,....._NEXT_CO
 4e535452 41494e54 04c30229 6401802c l NSTRAINT.)d..,
 00040180 105f4e45 58545f43 4f4e5354 l ....._NEXT_CONST
 5241494e 5403c302 2901802c 00040180 l RAINT.)..,....
 105f4e45 58545f43 4f4e5354 5241494e l ._NEXT_CONSTRAIN
 5404c302 28640180 2c000401 80105f4e l T.(d..,....._N
 4558545f 434f4e53 54524149 4e5403c3 l EXT_CONSTRAINT.
 02280180 2c000401 80105f4e 4558545f l .(..,....._NEXT_
 434f4e53 54524149 4e5404c3 02276401 l CONSTRAINT.'d.
 802c0004 0180105f 4e455854 5f434f4e l .,....._NEXT_CON
 53545241 494e5403 c3022701 802c0004 l STRAINT.'..,..
 0180105f 4e455854 5f434f4e 53545241 l ..._NEXT_CONSTRA
 494e5404 c3022664 01802c00 04018010 l INT.&d..,.....
 5f4e4558 545f434f 4e535452 41494e54 l _NEXT_CONSTRAINT
 03c30226 01802c00 04018010 5f4e4558 l .&..,....._NEX
 545f434f 4e535452 41494e54 04c30225 l T_CONSTRAINT.%
 6401802c 00040180 105f4e45 58545f43 l d..,....._NEXT_C
 4f4e5354 5241494e 5403c302 2501802c l ONSTRAINT.%..,
 00040180 105f4e45 58545f43 4f4e5354 l ....._NEXT_CONST
 5241494e 5404c302 24640180 2c000401 l RAINT.$d..,...
 800a5359 535f4330 30333132 03c2040d l ..SYS_C00312..
 01802c00 0401800a 5359535f 43303033 l ..,.....SYS_C003
 313303c2 040e0180 2c000401 800a5359 l 13....,.....SY
 535f4330 30333035 03c20406 01802c00 l S_C00305....,.
 0401800a 5359535f 43303033 303603c2 l ....SYS_C00306.

 <16 bytes per line>

BBED> p 1154
rowdata[26]
-----------
ub1 rowdata[26]                             @1154     0x14

BBED> modify /x 0x13 1154
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /u01/app/oracle/oradata/test/system01.dbf (1)
 Block: 170              Offsets: 1154 to 1665           Dba:0x004000aa
------------------------------------------------------------------------
 1301802c 00040180 105f4e45 58545f43 4f4e5354 5241494e 5403c302 2b01802c
 00040180 105f4e45 58545f43 4f4e5354 5241494e 5404c302 2a640180 2c000401
 80105f4e 4558545f 434f4e53 54524149 4e5403c3 022a0180 2c000401 80105f4e
 4558545f 434f4e53 54524149 4e5404c3 02296401 802c0004 0180105f 4e455854
 5f434f4e 53545241 494e5403 c3022901 802c0004 0180105f 4e455854 5f434f4e
 53545241 494e5404 c3022864 01802c00 04018010 5f4e4558 545f434f 4e535452
 41494e54 03c30228 01802c00 04018010 5f4e4558 545f434f 4e535452 41494e54
 04c30227 6401802c 00040180 105f4e45 58545f43 4f4e5354 5241494e 5403c302
 2701802c 00040180 105f4e45 58545f43 4f4e5354 5241494e 5404c302 26640180
 2c000401 80105f4e 4558545f 434f4e53 54524149 4e5403c3 02260180 2c000401
 80105f4e 4558545f 434f4e53 54524149 4e5404c3 02256401 802c0004 0180105f
 4e455854 5f434f4e 53545241 494e5403 c3022501 802c0004 0180105f 4e455854
 5f434f4e 53545241 494e5404 c3022464 01802c00 0401800a 5359535f 43303033
 313203c2 040d0180 2c000401 800a5359 535f4330 30333133 03c2040e 01802c00
 0401800a 5359535f 43303033 303503c2 04060180 2c000401 800a5359 535f4330
 30333036 03c20407 01802c00 0401800a 5359535f 43303033 303703c2 04080180

 <32 bytes per line>

BBED> sum apply      /*!!!!!!!!!!!!!!!!!!!!!!*/
Check value for File 1, Block 170:
current = 0x6470, required = 0x6470

BBED> exit

*******************************************************************************
此时创建带约束关系的table时将会报错ORA-08102,通过建表之前做10046的level 10的trace
跟踪建表在会话过程中的动作得知是在更新CON$表的CON#时出现了表和索引键值不一致
*******************************************************************************
oracle@test:~> sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Sun Oct 23 20:16:56 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  313868288 bytes
Fixed Size                  1299596 bytes
Variable Size             171969396 bytes
Database Buffers          134217728 bytes
Redo Buffers                6381568 bytes
Database mounted.
Database opened.
SQL> show parameter dump

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
background_core_dump                 string      partial
background_dump_dest                 string      /u01/app/oracle/diag/rdbms/tes
                                                 t/test/trace
core_dump_dest                       string      /u01/app/oracle/diag/rdbms/tes
                                                 t/test/cdump
max_dump_file_size                   string      unlimited
shadow_core_dump                     string      partial
user_dump_dest                       string      /u01/app/oracle/diag/rdbms/tes
                                                 t/test/trace
SQL> host
oracle@test:~> cd /u01/app/oracle/diag/rdbms/test/test/trace
oracle@test:/u01/app/oracle/diag/rdbms/test/test/trace> rm *.trc
oracle@test:/u01/app/oracle/diag/rdbms/test/test/trace> exit
exit

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@test:~> sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Sun Oct 23 20:18:01 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter session set events='10046 trace name context forever,level 10';

Session altered.
SQL> create table a(a integer not null);
create table a(a integer not null)
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-08102: index key not found, obj# 52, file 1, block 31415 (2)

/*此时做ANALYZE TABLE VALIDATE STRUCTURE CASCADE时会报错,说明表与索引不一致引起的*/
SQL> alter session set events='10046 trace name context off
  2  ';

Session altered.

TRACE_FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/test/test/trace/test_ora_9145.trc

SQL> select con# from con$ where name like '_NEXT_%';

      CON#
----------
     14218
*****************************************************************************************
分析10046 trace
根据错误号8102找trace中sqlid关键字,再根据此查询得到如下结果
可以看到NAME=_NEXT_CONSTRAINT对应的CON#之前值为14218,在更新为14219时发现表中的键值与
索引中的键值不一致从而出错,既然不一致,
那么下一步就根据错误发生时的对象(索引信息)dump出错时的索引块看索引的键值是否有明显错误
******************************************************************************************
----- Bind Info (kkscoacd) -----
 Bind#0
  acdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  acflg=08 fl2=0001 frm=00 csi=00 siz=24 ff=0
  kxsbbbfp=b775f2f0  bln=24  avl=04  flg=05
  value=14219
 Bind#1
  acdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  acflg=08 fl2=0001 frm=00 csi=00 siz=24 ff=0
  kxsbbbfp=b775f2cc  bln=24  avl=01  flg=05
  value=0
 Bind#2
  acdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  acflg=08 fl2=0001 frm=00 csi=00 siz=24 ff=0
  kxsbbbfp=b775f314  bln=22  avl=01  flg=05
  value=0
 Bind#3
  acdty=01 mxl=32(16) mxlc=00 mal=00 scl=00 pre=00
  acflg=18 fl2=0001 frm=01 csi=873 siz=32 ff=0
  kxsbbbfp=2ca3613e  bln=32  avl=16  flg=09
  value="_NEXT_CONSTRAINT"
 Frames pfr 0xb775f708 siz=4772 efr 0xb775f69c siz=4760
 Cursor frame. dump
  enxt: 3.0x0000061c  enxt: 2.0x00000050  enxt: 1.0x00000c2c
  pnxt: 1.0x0000000c
 kxscphp=0xb7817f70 siz=1000 inu=248 nps=168
 kxscbhp=0xb7759718 siz=1000 inu=240 nps=108
 kxscwhp=0xb77f0038 siz=4072 inu=292 nps=0
Starting SQL statement dump
SQL Information
user_id=0 user_name=SYS module=sqlplus@test (TNS V1-V3) action=
sql_id=bajr90ryjd2w8 plan_hash_value=-1720748009 problem_type=0
----- Current SQL Statement for this session (sql_id=bajr90ryjd2w8) -----
update con$ set con#=:3,spare1=:4 where owner#=:1 and name=:2
sql_text_length=62
sql=update con$ set con#=:3,spare1=:4 where owner#=:1 and name=:2
====================== END SQL Statement Dump ======================

*****************************************************************************************
根据报错时的obj# 52确定对象为CON$表的索引I_CON$
根据报错时的DBA,dump该索引的叶节点块,由于NAME=_NEXT_CONSTRAINT对应是键值的最大值,所以
在dump的叶节点块中,也应该是最后一行
*****************************************************************************************
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@test:~> cd /u01/app/oracle/diag/rdbms/test/test/trace/
oracle@test:/u01/app/oracle/diag/rdbms/test/test/trace> rm *.trc
oracle@test:/u01/app/oracle/diag/rdbms/test/test/trace> exit
logout
test:~ # su - oracle
oracle@test:~> sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Sun Oct 23 20:24:45 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> col owner format a10
SQL> col object_name format a13
SQL> select owner,object_name,object_type,status from dba_objects where object_id=52;

OWNER      OBJECT_NAME   OBJECT_TYPE         STATUS
---------- ------------- ------------------- -------
SYS        I_CON2        INDEX               VALID
/*也可以select name,type# from obj$ where obj#=52;   */

SQL> select table_name from dba_indexes where index_name='I_CON2';

TABLE_NAME
------------------------------
CON$

SQL> alter system dump datafile 1 block 31415;

System altered.

TRACE_FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/test/test/trace/test_ora_9183.trc

******************************************************************************************
从上面10046的trace可以知道表中NAME=_NEXT_CONSTRAINT对应的当前键值为14218
对比索引叶节点块的dump的trace可以知道,对应当前索引键值是14219
此时可以修改表中对应键值为14219,也可以修改索引键值为14218
(对应索引键值的上一个值为142117,中间隔一个,故可以这样做,否则只能修改表对应的键值)
下面的过程采用修改索引键值的方法
******************************************************************************************
Leaf block dump
===============
header address 633045084=0x25bb805c
kdxcolev 0
KDXCOLEV Flags = - - -
kdxcolok 0
kdxcoopc 0x80: pcode=0: iot flags=--- is converted=Y
kdxconco 1
kdxcosdc 1
kdxconro 360
kdxcofbo 756=0x2f4
kdxcofeo 2838=0xb16
kdxcoavs 2601
kdxlespl 0
kdxlende 0
kdxlenxt 0=0x0
kdxleprv 4225718=0x407ab6
kdxledsz 6
kdxlebksz 8032
row#356[3395] flag: ------, lock: 0, len=13, data:(6):  00 40 87 9e 00 d0
col 0; len 4; (4):  c3 02 2a 2d
row#357[3280] flag: ------, lock: 0, len=12, data:(6):  00 40 87 9e 00 d8
col 0; len 3; (3):  c3 02 2b
row#358[2864] flag: ------, lock: 0, len=13, data:(6):  00 40 87 9e 00 d2
col 0; len 4; (4):  c3 02 2b 12
row#359[2851] flag: ------, lock: 0, len=13, data:(6):  00 40 00 aa 00 0c
col 0; len 4; (4):  c3 02 2b 14
----- end of leaf block dump -----

***********************************************************************************
计算索引键值的位置并修改,重启DB,再创建带约束关系的表时,不再报错
***********************************************************************************
SQL> select 2851+44+2*24 from dual;

2851+44+2*24
------------
        2943

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@test:~> bbed parfile=bbed.par
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Sun Oct 23 20:32:15 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> set file 1 block 31415
        FILE#           1
        BLOCK#          31415

BBED> p 2943
rowdata[17]
-----------
ub1 rowdata[17]                             @2943     0x00

BBED> d /v
 File: /u01/app/oracle/oradata/test/system01.dbf (1)
 Block: 31415   Offsets: 2943 to 3454  Dba:0x00407ab7
-------------------------------------------------------
 00000040 00aa000c 04c3022b 14000000 l ...@...+....
 40879e00 d204c302 2b120100 004000aa l @...+....@.
 000c04c3 022b1301 00004087 9e00d304 l ...+....@...

                                                                                                        c3022b11 01000040 00aa000c 04c3022b l +....@...+
 12010000 40879e00 d204c302 2b0f0100 l ....@...+...
 004000aa 000c04c3 022b1101 00004087 l .@...+....@.
 9e00d304 c3022b0e 01000040 00aa000c l ..+....@..
 04c3022b 0f010000 40879e00 d204c302 l .+....@...

                                                   2b0c0100 0040879e 00d704c3 022b0d01 l +....@...+..
 00004000 aa000c04 c3022b0e 01000040 l ..@...+....@
 00aa000c 04c3022b 0d010000 40879e00 l ...+....@...
 d604c302 2b070100 0040879e 00d504c3 l +....@...
 022b0801 00004087 9e00d404 c3022b09 l .+....@...+.
 01000040 879e00d3 04c3022b 0a010000 l ...@...+....
 40879e00 d204c302 2b0b0100 004000aa l @...+....@.
 000c04c3 022b0c01 00004000 aa000c04 l ...+....@...
 c3022b0b 01000040 00aa000c 04c3022b l +....@...+
 0a010000 4000aa00 0c04c302 2b090100 l ....@...+...
 004000aa 000c04c3 022b0801 00004087 l .@...+....@.
 9e00d904 c3022b06 01000040 00aa000c l ..+....@..
 04c3022b 07010000 40879e00 d904c302 l .+....@...

                                                   2b040100 0040879e 00db04c3 022b0501 l +....@...+..
 00004000 aa000c04 c3022b06 01000040 l ..@...+....@
 00aa000c 04c3022b 05010000 40879e00 l ...+....@...
 da04c302 2b020100 0040879e 00d904c3 l +....@...
 022b0301 00004000 aa000c04 c3022b04 l .+....@...+.
 01000040 00aa000c 04c3022b 03000000 l ...@...+....
 40879e00 d803c302 2b010000 4000aa00 l @...+...@.

                                                   0c04c302 2b020100 004000aa 000c03c3 l ..+....@...
 022b0100 0040879e 00d204c3 022a3301 l .+...@...*3.
 00004087 9e00d304 c3022a32 01000040 l ..@...*2...@
 879e00d4 04c3022a 31010000 40879e00 l ...*1...@...

 <16 bytes per line>

BBED> p 2955
rowdata[29]
-----------
ub1 rowdata[29]                             @2955     0x14

BBED> modify /x 0x13 2955
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /u01/app/oracle/oradata/test/system01.dbf (1)
 Block: 31415            Offsets: 2955 to 3466           Dba:0x00407ab7
------------------------------------------------------------------------
 13000000 40879e00 d204c302 2b120100 004000aa 000c04c3 022b1301 00004087
 9e00d304 c3022b11 01000040 00aa000c 04c3022b 12010000 40879e00 d204c302
 2b0f0100 004000aa 000c04c3 022b1101 00004087 9e00d304 c3022b0e 01000040
 00aa000c 04c3022b 0f010000 40879e00 d204c302 2b0c0100 0040879e 00d704c3
 022b0d01 00004000 aa000c04 c3022b0e 01000040 00aa000c 04c3022b 0d010000
 40879e00 d604c302 2b070100 0040879e 00d504c3 022b0801 00004087 9e00d404
 c3022b09 01000040 879e00d3 04c3022b 0a010000 40879e00 d204c302 2b0b0100
 004000aa 000c04c3 022b0c01 00004000 aa000c04 c3022b0b 01000040 00aa000c
 04c3022b 0a010000 4000aa00 0c04c302 2b090100 004000aa 000c04c3 022b0801
 00004087 9e00d904 c3022b06 01000040 00aa000c 04c3022b 07010000 40879e00
 d904c302 2b040100 0040879e 00db04c3 022b0501 00004000 aa000c04 c3022b06
 01000040 00aa000c 04c3022b 05010000 40879e00 da04c302 2b020100 0040879e
 00d904c3 022b0301 00004000 aa000c04 c3022b04 01000040 00aa000c 04c3022b
 03000000 40879e00 d803c302 2b010000 4000aa00 0c04c302 2b020100 004000aa
 000c03c3 022b0100 0040879e 00d204c3 022a3301 00004087 9e00d304 c3022a32
 01000040 879e00d4 04c3022a 31010000 40879e00 d504c302 2a300100 0040879e

 <32 bytes per line>

BBED> sum apply
Check value for File 1, Block 31415:
current = 0xb685, required = 0xb685

BBED> exit

oracle@test:~> sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Sun Oct 23 20:34:48 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  313868288 bytes
Fixed Size                  1299596 bytes
Variable Size             171969396 bytes
Database Buffers          134217728 bytes
Redo Buffers                6381568 bytes
Database mounted.
Database opened.
SQL> create table a(a integer not null);

Table created.


###############################################################################
ORA-08102通常是由于表与索引出现不一致导致,通过有三种情况
1.如果损坏为索引,则删除索引并重建索引  
------但对于index的obj#小于56的情况,由于是核心的bootstrap$对象,
      index是在DB启动时由DB自动创建,此种情况下通过设置event 38003或migrate
      都不能解决,但obj#>56的则可以
2.如果损坏为块级别,则采用坏块的处理方法
3.如果损坏的为表的记录级别的则采用bbed或其它工具
---------两边不一致改表和索引都能达到目的,只要一致即可,
   但有一个原则就是索引键值始终要保证按顺序递增
###############################################################################

 

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

转载于:http://blog.itpub.net/16807927/viewspace-709571/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值