证券ODS核心子系统向监管报表推送融资融券数据作业报ORA-08103错误

Event Id: 2633

Time : Thu Oct 31 19:39:27 2013

Type  : FATAL

User  : dsadm

Message    :

         TRD_STATUS,0: Oracle call failed; sqlcode = -8,103; message: ORA-08103: object no longer exists

         .

Event Id: 2634

Time : Thu Oct 31 19:39:27 2013

Type  : FATAL

User  : dsadm

Message    :

         TRD_STATUS,0: Open failed for: select case

                  when count(1) = 0 then

                  from kgdb.h_matching

         ......

                 相关SQL

----

问题解决:

跑这个任务的时候有别的任务对kgdb.h_matching这个表进行truncate操作,

见如下描述,如果查询已经开始,但是另外一个任务针对这个对象执行truncate操作

可能会碰到ORA-08103.

symptom: Error performing a SELECT statement
symptom: ORA-08103: object no longer exists
symptom: Table is being truncated by other session
symptom: Analyze table validate structure cascade returns no errors
cause: This ORA-08103 occurs on the next block read after the truncate 
command.
The LOCK TABLE IN EXCLUSIVE MODE does not prevent the table from being
SELECTED from. Thus, when the query has started and while this query runs
and the truncate occurs, this ORA-08103 may surface on the next block read.
This is considered intended behavior.
When a TRUNCATE occurs the DATAOBJ# in OBJ$ gets increased by one and thus
may lead to this ORA-08103 'object no longer exists'

fix:

Possible solutions are:
- Use DELETE instead of TRUNCATE
- Use SELECT FOR UPDATE as this will try to lock the table

另外附ora-08103错误的诊断方法:

ORA-08103问题的诊断最好是能生成8103错误的ERROR STACK TRACE, 在TRACE中会记录具体引发8103的对象的OBJ和OBJD,这便于我们定位可能存在corruption的对象。

问题在于往往前台进程遇到ORA-08103错误不会在后台生成TRACE文件,这需要我们手动设置8103 触发ERRORSTACK的EVENTS:

 

ALTER SYSTEM SET  EVENTS  ’ 8103 TRACE NAME ERRORSTACK LEVEL 3′;

解决思路包括:
1. 通过OBJD和DBA定位到具体的表名和块号
2. 有条件的情况下对该表做一个analyze .. validate structure
3. 有条件的情况下对该表所在tablespace做一个 dbms_space_admin.ASSM_TABLESPACE_VERIFY
4. 有条件的情况下move这张表或者相关的分区,尝试绕过该问题
5. 有条件的情况下降该表或分区移动到MSSM表空间上,绕过该问题

execute dbms_space_admin.tablespace_verify(‘&tablespace_name’)
oradebug setmypid
oradebug tracefile_name

 

execute dbms_space_admin.assm_tablespace_verify(‘&tablespace_name’,dbms_space_admin.TS_VERIFY_BITMAPS)
oradebug setmypid
oradebug tracefile_name