在做恢复测试,几次都遇到了ORA-08103: object no longer exists错误,后来索性将其解决了,解决过程记录一下:
primary:/home/oracle/tools$sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 28 22:57:38 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@ora11g> select * from songyb;
select * from songyb
*
ERROR at line 1:
ORA-08103: object no longer exists
SYS@ora11g>
SYS@ora11g>
SYS@ora11g> select object_id,object_name from dba_objects where object_name = 'SONGYB';
OBJECT_ID
----------
OBJECT_NAME
--------------------------------------------------------------------------------
89494
SONGYB
SYS@ora11g>
SYS@ora11g> oradebug setmypid
Statement processed.
SYS@ora11g> oradebug event 10046 trace name context forever
Statement processed.
SYS@ora11g> oradebug tracefile_name
/u01/app/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_8776.trc
SYS@ora11g> select * from songyb;
select * from songyb
*
ERROR at line 1:
ORA-08103: object no longer exists
SYS@ora11g> oradebug event 10046 trace name context off
Statement processed.
SYS@ora11g> !more /u01/app/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_8776.trc
Trace file /u01/app/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_8776.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
::::::::省略::::::::
=====================
PARSING IN CURSOR #140352443479616 len=20 dep=0 uid=0 oct=3 lid=0 tim=1575000220577091 hv=2081318803 ad='70fe03c8' sqlid='7x4ydv5y0wtwm'
select * from songyb
END OF STMT
PARSE #140352443479616:c=13997,e=15692,p=0,cr=275,cu=0,mis=1,r=0,dep=0,og=1,plh=1875113312,tim=1575000220577090
EXEC #140352443479616:c=1000,e=69,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=1875113312,tim=1575000220577208
*** SESSION ID:(19.9) 2019-11-28 23:03:40.577
OBJD MISMATCH typ=6, seg.obj=89494, diskobj=89493, dsflg=100001, dsobj=89494, tid=89494, cls=1 《《《 从这里可以看出是diskobj不一致导致。
FETCH #140352443479616:c=0,e=169,p=1,cr=1,cu=0,mis=0,r=0,dep=0,og=1,plh=1875113312,tim=1575000220577422
STAT #140352443479616 id=1 cnt=0 pid=0 pos=1 obj=89494 op='TABLE ACCESS FULL SONGYB (cr=0 pr=0 pw=0 time=2 us cost=2 size=6 card=1)'
*** 2019-11-28 23:04:01.300
CLOSE #140352443479616:c=0,e=6,dep=0,type=0,tim=1575000241300438
*** 2019-11-28 23:04:01.300
Processing Oradebug command 'event 10046 trace name context off'
*** 2019-11-28 23:04:01.300
Oradebug command 'event 10046 trace name context off' console output:
SYS@ora11g>
<<< 把表songyb删除掉重新做了一遍,还是同样的错误,这次object_id为89506。
SYS@ora11g> select object_id from dba_objects where object_name = 'SONGYB';
OBJECT_ID
----------
89506
BBED> p ktbbh
struct ktbbh, 72 bytes @20
ub1 ktbbhtyp @20 0x01 (KDDBTDATA)
union ktbbhsid, 4 bytes @24
ub4 ktbbhsg1 @24 0x00015d95 <<< seg/obj Object ID in dictionary
ub4 ktbbhod1 @24 0x00015d95
struct ktbbhcsc, 8 bytes @28
ub4 kscnbas @28 0x40032d32
ub2 kscnwrp @32 0x0000
sb2 ktbbhict @36 2
ub1 ktbbhflg @38 0x03 (KTBFONFL)
ub1 ktbbhfsl @39 0x00
ub4 ktbbhfnx @40 0x00000000
struct ktbbhitl[0], 24 bytes @44
struct ktbitxid, 8 bytes @44
ub2 kxidusn @44 0x0006
ub2 kxidslt @46 0x001d
ub4 kxidsqn @48 0x0000050b
struct ktbituba, 8 bytes @52
ub4 kubadba @52 0x00c00354
ub2 kubaseq @56 0x00ed
ub1 kubarec @58 0x1e
ub2 ktbitflg @60 0x2001 (KTBFUPB)
union _ktbitun, 2 bytes @62
sb2 _ktbitfsc @62 0
ub2 _ktbitwrp @62 0x0000
ub4 ktbitbas @64 0x40032d33
struct ktbbhitl[1], 24 bytes @68
struct ktbitxid, 8 bytes @68
ub2 kxidusn @68 0x0000
ub2 kxidslt @70 0x0000
ub4 kxidsqn @72 0x00000000
struct ktbituba, 8 bytes @76
ub4 kubadba @76 0x00000000
ub2 kubaseq @80 0x0000
ub1 kubarec @82 0x00
ub2 ktbitflg @84 0x0000 (NONE)
union _ktbitun, 2 bytes @86
sb2 _ktbitfsc @86 0
ub2 _ktbitwrp @86 0x0000
ub4 ktbitbas @88 0x00000000
BBED>
BBED>
BBED> d /v offset 24 count 10
File: /u01/app/oracle/oradata/ora11g/system01.dbf (1)
Block: 96033 Offsets: 24 to 33 Dba:0x00417721
-------------------------------------------------------
955d0100 322d0340 0000 l .]..2-.@..
<16 bytes per line>
SYS@ora11g> c/0xxxx/
1* select to_number('15d95','xxxxxxxx') from dual
SYS@ora11g> /
TO_NUMBER('15D95','XXXXXXXX')
-----------------------------
89493 <<< linux系统955d0100存储的信息其实就是89493,这也就是报错的提示信息,将其修改为正确的。
SYS@ora11g> select to_char('89506','xxxxxx') from dual;
TO_CHAR
-------
15da2 <<< 正确的信息,下面进行修改
BBED> modify /x a2 offset 24
File: /u01/app/oracle/oradata/ora11g/system01.dbf (1)
Block: 96033 Offsets: 24 to 33 Dba:0x00417721
------------------------------------------------------------------------
a25d0100 322d0340 0000
<32 bytes per line>
BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle/oradata/ora11g/system01.dbf
BLOCK = 96033
Block 96033 is corrupt
Corrupt block relative dba: 0x00417721 (file 0, block 96033)
Bad check value found during verification
Data in bad block:
type: 6 format: 2 rdba: 0x00417721
last change scn: 0x0000.40032d33 seq: 0x5 flg: 0x06
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x2d330605
check value in block header: 0x5961
computed block checksum: 0x37
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing (Index): 0
Total Blocks Empty : 0
Total Blocks Marked Corrupt : 1
Total Blocks Influx : 0
Message 531 not found; product=RDBMS; facility=BBED
BBED> sum apply
Check value for File 1, Block 96033:
current = 0x5956, required = 0x5956
BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle/oradata/ora11g/system01.dbf
BLOCK = 96033
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing (Index): 0
Total Blocks Empty : 0
Total Blocks Marked Corrupt : 0
Total Blocks Influx : 0
Message 531 not found; product=RDBMS; facility=BBED
BBED> find /c songyb
BBED-00212: search string not found
BBED> find /c songy
File: /u01/app/oracle/oradata/ora11g/system01.dbf (1)
Block: 96033 Offsets: 8183 to 8191 Dba:0x00417721
------------------------------------------------------------------------
736f6e67 79050633 2d
<32 bytes per line>
SYS@ora11g> select * from songyb; <<< 修改后可以正确查询。
NAME
--------------------
songy
至此,修复完毕。