暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

oracle ora-600[2662]问题分析及异常恢复

数据库技术笔记 2021-02-04
2003

1. 内容概述

    ORA-600[2662]问题常见于服务器异常重启、使用隐含参数(_ALLOW_RESETLOGS_CORRUPTION)等原因,
使用推进scn方法可修复该问题,但常规推进scn方法逐渐被oracle禁用,本文使用bbed及自研工具两种方法修复该问题,
操作过程如下。

2. 官方解释

Note: For additional ORA-600 related information please read Note:146580.1
PURPOSE:
This article discusses the internal error "ORA-600 [2662]", what
it means and possible actions. The information here is only applicable
to the versions listed and is provided only for guidance.
ERROR:
Format: ORA-600 [2662] [a] [b] [c] [d] [e]
VERSIONS:
versions 6.0 to 12.1
DESCRIPTION:
A data block SCN is ahead of the current SCN.
The ORA-600 [2662] occurs when an SCN is compared to the dependent SCN
stored in a UGA variable.
If the SCN is less than the dependent SCN then we signal the ORA-600 [2662]
internal error.
ARGUMENTS:
Arg [a] Current SCN WRAP
Arg [b] Current SCN BASE
Arg [c] dependent SCN WRAP
Arg [d] dependent SCN BASE
Arg [e] Where present this is the DBA where the dependent SCN came from.
FUNCTIONALITY:
File and IO buffer management for redo logs
IMPACT:
INSTANCE FAILURE
POSSIBLE PHYSICAL CORRUPTION
SUGGESTIONS:
There are different situations where ORA-600 [2662] can be raised.
It can be raised on startup or during database operation.
If not using Parallel Server, check that 2 instances have not mounted
the same database.
Check for SMON traces and have the alert.log and trace files ready
to send to support.
Check the SCN difference [argument d]-[argument b].
If the SCNs in the error are very close, then try to shutdown and startup
the instance several times.
In some situations, the SCN increment during startup may permit the
database to open. Keep track of the number of times you attempted a
startup.
If the Known Issues section below does not help in terms of identifying
a solution, please submit the trace files and alert.log to Oracle
Support Services for further analysis

3. 问题模拟

[oracle@sourcedb bbed]$ ./l_bbed.sh 

BBED: Release 2.0.0.0.0 - Limited Production on Mon Jun 15 14:53:31 2020

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

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

BBED> set dba 1.241
BBED-00205: illegal or out of range DBA (File 0, Block 1)


BBED> set dba 1,241
DBA 0x004000f1 (4194545 1,241)

BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0x06
ub1 frmt_kcbh @1 0xa2
ub1 spare1_kcbh @2 0x00
ub1 spare2_kcbh @3 0x00
ub4 rdba_kcbh @4 0x004000f1
ub4 bas_kcbh @8 0x00061727
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x01
ub1 flg_kcbh @15 0x06 (KCBHFDLC, KCBHFCKV)
ub2 chkval_kcbh @16 0xbc56
ub2 spare3_kcbh @18 0x0000

BBED> assign kcbh.bas_kcbh=0x01061727
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub4 bas_kcbh @8 0x01061727

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

BBED> v
DBVERIFY - Verification starting
FILE = /data2/enmo/system01.dbf
BLOCK = 241


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>

SQL> startup
ORACLE instance started.

Total System Global Area 1202556928 bytes
Fixed Size 2252704 bytes
Variable Size 385876064 bytes
Database Buffers 805306368 bytes
Redo Buffers 9121792 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [2662], [0], [485018], [0],
[17176359], [4194545], [], [], [], [], [], []
Process ID: 7238
Session ID: 1 Serial number: 5


SQL>

4. 问题分析

ORA-00600: internal error code, arguments: [2662], [0], [485018], [0],[17176359], [4194545]

oradebug setmypid
oradebug event 10046 trace name context forever,level 12
oradebug tracefile_name
alter database open;


PARSING IN CURSOR #47731708498056 len=52 dep=1 uid=0 oct=3 lid=0 tim=1592204445544699 hv=429618617 ad='a6887978' sqlid='4krwuz0ctqxdt'
select ctime, mtime, stime from obj$ where obj# = :1
END OF STMT
PARSE #47731708498056:c=999,e=409,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=0,tim=1592204445544698
BINDS #47731708498056:
Bind#0
oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
oacflg=00 fl2=0001 frm=00 csi=00 siz=24 off=0
kxsbbbfp=2b6968d95fe8 bln=22 avl=02 flg=05
value=20
EXEC #47731708498056:c=1000,e=865,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=1218588913,tim=1592204445545652
Bind#0
oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
oacflg=00 fl2=0001 frm=00 csi=00 siz=24 off=0
kxsbbbfp=2b6968d95fe8 bln=22 avl=02 flg=05
value=20
EXEC #47731708498056:c=1000,e=865,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=1218588913,tim=1592204445545652
WAIT #47731708498056: nam='db file sequential read' ela= 10 file#=1 block#=337 blocks=1 obj#=36 tim=1592204445545722
WAIT #47731708498056: nam='db file sequential read' ela= 4 file#=1 block#=338 blocks=1 obj#=36 tim=1592204445545767
WAIT #47731708498056: nam='db file sequential read' ela= 5 file#=1 block#=241 blocks=1 obj#=18 tim=1592204445545804 <-- 访问 dba 1,241
=====================
PARSING IN CURSOR #47731730630712 len=142 dep=2 uid=0 oct=3 lid=0 tim=1592204445546257 hv=361892850 ad='a6886c48' sqlid='7bd391hat42zk'
select /*+ rule */ name,file#,block#,status$,user#,undosqn,xactsqn,scnbas,scnwrp,DECODE(inst#,0,NULL,inst#),ts#,spare1 from undo$ where us#=:1
END OF STMT
PARSE #47731730630712:c=1000,e=408,p=0,cr=0,cu=0,mis=1,r=0,dep=2,og=3,plh=0,tim=1592204445546256
BINDS #47731730630712:
Bind#0
oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0
kxsbbbfp=2b6968d943f0 bln=22 avl=02 flg=05
value=8
EXEC #47731730630712:c=0,e=538,p=0,cr=0,cu=0,mis=1,r=0,dep=2,og=3,plh=906473769,tim=1592204445546896
WAIT #47731730630712: nam='db file sequential read' ela= 6 file#=1 block#=321 blocks=1 obj#=34 tim=1592204445546939
WAIT #47731730630712: nam='db file sequential read' ela= 5 file#=1 block#=225 blocks=1 obj#=15 tim=1592204445546979
FETCH #47731730630712:c=0,e=98,p=2,cr=2,cu=0,mis=0,r=1,dep=2,og=3,plh=906473769,tim=1592204445547016
STAT #47731730630712 id=1 cnt=1 pid=0 pos=1 obj=15 op='TABLE ACCESS BY INDEX ROWID UNDO$ (cr=2 pr=2 pw=0 time=89 us)'
STAT #47731730630712 id=2 cnt=1 pid=1 pos=1 obj=34 op='INDEX UNIQUE SCAN I_UNDO1 (cr=1 pr=1 pw=0 time=46 us)'
CLOSE #47731730630712:c=0,e=4,dep=2,type=0,tim=1592204445547138
WAIT #47731708498056: nam='db file sequential read' ela= 14 file#=3 block#=2365 blocks=1 obj#=0 tim=1592204445547181
Incident 140579 created, dump file: /u01/app/oracle/diag/rdbms/enmo/enmo/incident/incdir_140579/enmo_ora_7343_i140579.trc
ORA-00600: internal error code, arguments: [2662], [0], [525028], [0], [17176359], [4194545], [], [], [], [], [], []

FETCH #47731708498056:c=952855,e=970652,p=6,cr=6,cu=0,mis=0,r=0,dep=1,og=4,plh=1218588913,tim=1592204446516322
STAT #47731708498056 id=1 cnt=0 pid=0 pos=1 obj=18 op='TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=14 us)' <-- 访问obj$报错
STAT #47731708498056 id=2 cnt=1 pid=1 pos=1 obj=36 op='INDEX RANGE SCAN I_OBJ1 (cr=2 pr=2 pw=0 time=129 us)'
ORA-00704: bootstrap process failure
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [2662], [0], [525028], [0], [17176359], [4194545], [], [], [], [], [], []
ORA-00704: bootstrap process failure
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [2662], [0], [525028], [0], [17176359], [4194545], [], [], [], [], [], []

4194545(十进制)->4000F1(十六进制)
[oracle@sourcedb ~]$ ora_rdba 0x004000F1
*******Welcome to use ora_rdba tool authored by orastar.*******
*******weixin: xidoublestar*******
rdba is: 0x4000f1
datafile# is: 1
datablock is: 241
dump command:alter system dump datafile 1 block 241;
[oracle@sourcedb ~]$

5. 查询文件头scn

SQL> select file#,name,checkpoint_change# from v$datafile_header;

FILE# NAME CHECKPOINT_CHANGE#
---------- ------------------------------------------------------------ ------------------
1 /data2/enmo/system01.dbf 525025
2 /data2/enmo/sysaux01.dbf 525025
3 /data2/enmo/undotbs01.dbf 525025
4 /data2/enmo/users01.dbf 525025
5 /data2/enmo/hsql01.dbf 525025
6 /data2/enmo/star01.dbf 525025

6 rows selected.

SQL>

6. 使用bbed检查dependent block

[oracle@sourcedb bbed]$ ./l_bbed.sh 

BBED: Release 2.0.0.0.0 - Limited Production on Mon Jun 15 15:14:16 2020

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

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

BBED> set dba 1,241
DBA 0x004000f1 (4194545 1,241)

BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0x06
ub1 frmt_kcbh @1 0xa2
ub1 spare1_kcbh @2 0x00
ub1 spare2_kcbh @3 0x00
ub4 rdba_kcbh @4 0x004000f1
ub4 bas_kcbh @8 0x01061727 <--数据块kcbh scn大于datahdr中的scn
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x01
ub1 flg_kcbh @15 0x06 (KCBHFDLC, KCBHFCKV)
ub2 chkval_kcbh @16 0xbc56
ub2 spare3_kcbh @18 0x0000

BBED> p ktbbh
struct ktbbh, 48 bytes @20
ub1 ktbbhtyp @20 0x01 (KDDBTDATA)
union ktbbhsid, 4 bytes @24
ub4 ktbbhsg1 @24 0x00000012
ub4 ktbbhod1 @24 0x00000012
struct ktbbhcsc, 8 bytes @28
ub4 kscnbas @28 0x00060825
ub2 kscnwrp @32 0x0000
sb2 ktbbhict @36 -2047
ub1 ktbbhflg @38 0x02 (NONE)
ub1 ktbbhfsl @39 0x00
ub4 ktbbhfnx @40 0x00000000
struct ktbbhitl[0], 24 bytes @44
struct ktbitxid, 8 bytes @44
ub2 kxidusn @44 0x0008
ub2 kxidslt @46 0x0019
ub4 kxidsqn @48 0x000000f5
struct ktbituba, 8 bytes @52
ub4 kubadba @52 0x00c0093d
ub2 kubaseq @56 0x0043
ub1 kubarec @58 0x05
ub2 ktbitflg @60 0x8000 (KTBFCOM)
union _ktbitun, 2 bytes @62
sb2 _ktbitfsc @62 0
ub2 _ktbitwrp @62 0x0000
ub4 ktbitbas @64 0x00061727

BBED>

7. 工具恢复

[oracle@sourcedb xdul]$ ./xdul

xdul: Data Unload for Oracle version 1.1.1

Copyright(c) 2020 orastar.All rights reserved.

Wechat: xidoublestr
Email: 634025070@qq.com
loading default config.......

load config file 'config.txt' successful
loading default control file ......


ts# fn rfn bsize blocks filename kscnbas_484 kcvcptim_496 kcvfhrlc_112 kscnbas_116
---- ---- ---- ----- -------- -------------------------------------------- -------- -------- -------- --------
0 1 1 8192 41600 /data2/enmo/system01.dbf 85107 3e2d8e61 3e232bf3 1
1 2 2 8192 41600 /data2/enmo/sysaux01.dbf 85107 3e2d8e61 3e232bf3 1
2 3 3 8192 25600 /data2/enmo/undotbs01.dbf 85107 3e2d8e61 3e232bf3 1
4 4 4 8192 64000 /data2/enmo/users01.dbf 85107 3e2d8e61 3e232bf3 1
5 5 5 8192 12800 /data2/enmo/hsql01.dbf 85107 3e2d8e61 3e232bf3 1
6 6 6 8192 12800 /data2/enmo/star01.dbf 85107 3e2d8e61 3e232bf3 1
load control file 'control.txt' successful
XDUL>rscn
please input target scn(max: 0xffffffff): 0x02061727
loading default control file ......


ts# fn rfn bsize blocks filename kscnbas_484 kcvcptim_496 kcvfhrlc_112 kscnbas_116
---- ---- ---- ----- -------- -------------------------------------------- -------- -------- -------- --------
0 1 1 8192 41600 /data2/enmo/system01.dbf 2061727 3e2d8e61 3e232bf3 1
1 2 2 8192 41600 /data2/enmo/sysaux01.dbf 2061727 3e2d8e61 3e232bf3 1
2 3 3 8192 25600 /data2/enmo/undotbs01.dbf 2061727 3e2d8e61 3e232bf3 1
4 4 4 8192 64000 /data2/enmo/users01.dbf 2061727 3e2d8e61 3e232bf3 1
5 5 5 8192 12800 /data2/enmo/hsql01.dbf 2061727 3e2d8e61 3e232bf3 1
6 6 6 8192 12800 /data2/enmo/star01.dbf 2061727 3e2d8e61 3e232bf3 1
load control file 'control.txt' successful
XDUL>XDUL>exit

[oracle@sourcedb xdul]$
[oracle@sourcedb xdul]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 15 18:17:25 2020

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1202556928 bytes
Fixed Size 2252704 bytes
Variable Size 385876064 bytes
Database Buffers 805306368 bytes
Redo Buffers 9121792 bytes
Database mounted.
Database opened.
SQL>

8. bbed恢复

[oracle@sourcedb bbed]$ ./l_bbed.sh 

BBED: Release 2.0.0.0.0 - Limited Production on Mon Jun 15 18:24:24 2020

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

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

BBED> set dba 1,241
DBA 0x004000f1 (4194545 1,241)

BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0x06
ub1 frmt_kcbh @1 0xa2
ub1 spare1_kcbh @2 0x00
ub1 spare2_kcbh @3 0x00
ub4 rdba_kcbh @4 0x004000f1
ub4 bas_kcbh @8 0x01061727
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x01
ub1 flg_kcbh @15 0x06 (KCBHFDLC, KCBHFCKV)
ub2 chkval_kcbh @16 0xbc56
ub2 spare3_kcbh @18 0x0000

BBED> assign kcbh.bas_kcbh=0x03061727
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub4 bas_kcbh @8 0x03061727

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

BBED> v
DBVERIFY - Verification starting
FILE = /data2/enmo/system01.dbf
BLOCK = 241


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> exit

[oracle@sourcedb bbed]$
[oracle@sourcedb bbed]$
[oracle@sourcedb bbed]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 15 18:25:16 2020

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1202556928 bytes
Fixed Size 2252704 bytes
Variable Size 385876064 bytes
Database Buffers 805306368 bytes
Redo Buffers 9121792 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [2662], [0], [33954361], [0],
[50730791], [4194545], [], [], [], [], [], []
Process ID: 8619
Session ID: 1 Serial number: 5


SQL>


[oracle@sourcedb bbed]$ ./l_bbed.sh

BBED: Release 2.0.0.0.0 - Limited Production on Mon Jun 15 18:25:58 2020

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

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

BBED> info
File# Name Size(blks)
----- ---- ----------
1 /data2/enmo/system01.dbf 0
2 /data2/enmo/sysaux01.dbf 0
3 /data2/enmo/undotbs01.dbf 0
4 /data2/enmo/users01.dbf 0
5 /data2/enmo/hsql01.dbf 0
6 /data2/enmo/star01.dbf 0 0

BBED> assign dba 1,1 kcvfhckp.kcvcpscn.kscnbas=0x06061a37
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub4 kscnbas @484 0x06061a37

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

BBED> assign dba 2,1 kcvfhckp.kcvcpscn.kscnbas=0x06061a37
ub4 kscnbas @484 0x06061a37

BBED> sum dba 2,1 apply
Check value for File 2, Block 1:
current = 0x2d8b, required = 0x2d8b

BBED> assign dba 3,1 kcvfhckp.kcvcpscn.kscnbas=0x06061a37
ub4 kscnbas @484 0x06061a37

BBED> sum dba 3,1 apply
Check value for File 3, Block 1:
current = 0xd550, required = 0xd550

BBED> assign dba 4,1 kcvfhckp.kcvcpscn.kscnbas=0x06061a37
ub4 kscnbas @484 0x06061a37

BBED> sum dba 4,1 apply
Check value for File 4, Block 1:
current = 0x3814, required = 0x3814

BBED> assign dba 5,1 kcvfhckp.kcvcpscn.kscnbas=0x06061a37
ub4 kscnbas @484 0x06061a37

BBED> sum dba 5,1 apply
Check value for File 5, Block 1:
current = 0xc134, required = 0xc134

BBED> assign dba 6,1 kcvfhckp.kcvcpscn.kscnbas=0x06061a37
ub4 kscnbas @484 0x06061a37

BBED> sum dba 6,1 apply
Check value for File 6, Block 1:
current = 0x522b, required = 0x522b

BBED>

[oracle@sourcedb bbed]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 15 18:30:54 2020

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1202556928 bytes
Fixed Size 2252704 bytes
Variable Size 385876064 bytes
Database Buffers 805306368 bytes
Redo Buffers 9121792 bytes
Database mounted.
Database opened.
SQL>


文章转载自数据库技术笔记,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论