[20150601]模拟ora-00600[2608]错误.txt
--前几天在测试使用bbed解决丢失的归档,链接:
http://blog.itpub.net/267265/viewspace-1676438/ [20150529]使用bbed解决丢失的归档.txt
--出现如下错误:
ORA-00600: internal error code, arguments: [2608], [1], [2], [4101877000], [2], [4101877009], [], []
--不过后续的我做的操作在也没有出现这个错误.上午看了刘工的链接:
http://www.askmaclean.com/archives/oracle%E5%86%85%E9%83%A8%E9%94%99%E8%AF%AFora-00600-2608%E4%B8%80%E4%BE%8B.html
--自己重复模拟看看:
该ORA-00600[2608]可能由数据文件头中记录的checkpoint scn过小造成,Oracle会将该checkpoint scn与块中的resetlogs scn以及控制
文件中记录的日志文件的Low scn相比较,若文件头中的checkpoint scn远小于对比值,那么就会出现ORA-00600[2608]内部错误。
下面我们通过修改数据文件头中kcvfhckp结构中记录的checkpoint scn到一个较小值,来模拟出发ORA-00600[2608]内部错误:
1.测试环境:
SYS@test> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- ----------------------------------------------------------------
x86_64/Linux 2.4.xx 10.2.0.4.0 Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
--启动数据库到mount状态.
SYS@test> SELECT file#, CHECKPOINT_CHANGE#, UNRECOVERABLE_CHANGE# ,LAST_CHANGE#, OFFLINE_CHANGE#, ONLINE_CHANGE#,status FROM v$datafile;
FILE# CHECKPOINT_CHANGE# UNRECOVERABLE_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ONLINE_CHANGE# STATUS
------------ ------------------ --------------------- ------------ --------------- -------------- ----------
1 12691983312 0 12691983312 0 0 SYSTEM
2 12691983312 0 12691983312 0 0 ONLINE
3 12691983312 0 12691983312 0 0 ONLINE
4 12691983312 0 12691983312 0 0 ONLINE
5 12691983312 0 12691983312 0 0 ONLINE
6 12691983312 0 12691983312 12691975496 12691983100 ONLINE
6 rows selected.
SYS@test> SELECT file#, CHECKPOINT_CHANGE#, CREATION_CHANGE# , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy FROM v$datafile_header;
FILE# CHECKPOINT_CHANGE# CREATION_CHANGE# RESETLOGS_CHANGE# STATUS CHECKPOINT_COUNT FUZ
------------ ------------------ ---------------- ----------------- ---------- ---------------- ---
1 12691983312 5 12691748925 ONLINE 868465271 NO
2 12691983312 600647 12691748925 ONLINE 868465271 NO
3 12691983312 6678 12691748925 ONLINE 868465271 NO
4 12691983312 10685 12691748925 ONLINE 868465274 NO
5 12691983312 625439 12691748925 ONLINE 868465271 NO
6 12691983312 11997383136 12691748925 ONLINE 292 NO
6 rows selected.
SYS@test> @ &r/logfile
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME GROUP# STATUS TYPE MEMBER IS_
------ ------- --------- ----------- ------- --- ---------- ------------- ------------------- ------ ---------- ---------- ----------------------------- ---
1 1 40 52428800 1 YES INACTIVE 12691887202 2015-05-30 04:05:39 1 ONLINE /mnt/ramdisk/test/redo01.log NO
2 1 41 52428800 1 NO CURRENT 12691935321 2015-05-31 10:08:21 2 ONLINE /mnt/ramdisk/test/redo02.log NO
3 1 39 52428800 1 YES INACTIVE 12691855595 2015-05-29 10:32:22 3 ONLINE /mnt/ramdisk/test/redo03.log NO
--当前数据文件6的scn是12691983312.
12691983312-2^33=4102048720
4102048720 = 0xf4804bd0
0xf4700000 = 4100980736
4100980736+2^33=12690915328
修改为 0xf4700000
--RESETLOGS_CHANGE#
12691748925-2^33=4101814333
4101814333 = 0xf47cb83d
----我准备将scn最后4位修改为f4804bd0=>0xf4700000看看(比RESETLOGS_CHANGE#小).(注意我的测试环境wrap=2,要扣除2^32*2)
2.bbed修改:
BBED> set dba 6,1
DBA 0x01800001 (25165825 6,1)
BBED> p kcvfh.kcvfhrls
struct kcvfhrls, 8 bytes @116
ub4 kscnbas @116 0xf47cb83d
ub2 kscnwrp @120 0x0002
--resetlogset scn,与前面的正好对上.
f47cb83d = 4101814333
4101814333+2^33=12691748925
-----
BBED> p kcvfh.kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0xf4804bd0
ub2 kscnwrp @488 0x0002
ub4 kcvcptim @492 0x3486c9dc
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x00000029
ub4 kcrbabno @504 0x00012fa6
ub2 kcrbabof @508 0x0010
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0xf4804bd0
--要颠倒1下.
BBED> modify /x 0000
...
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0xf4800000
BBED> set offset +2
OFFSET 486
BBED> modify /x 70f4
...
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0xf4800000
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0xf4700000
BBED> sum apply ;
Check value for File 6, Block 1:
current = 0x28e6, required = 0x28e6
3.开始测试:
SYS@test> SELECT file#, CHECKPOINT_CHANGE#, UNRECOVERABLE_CHANGE# ,LAST_CHANGE#, OFFLINE_CHANGE#, ONLINE_CHANGE#,status FROM v$datafile;
FILE# CHECKPOINT_CHANGE# UNRECOVERABLE_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ONLINE_CHANGE# STATUS
------------ ------------------ --------------------- ------------ --------------- -------------- ----------
1 12691983312 0 12691983312 0 0 SYSTEM
2 12691983312 0 12691983312 0 0 ONLINE
3 12691983312 0 12691983312 0 0 ONLINE
4 12691983312 0 12691983312 0 0 ONLINE
5 12691983312 0 12691983312 0 0 ONLINE
6 12691983312 0 12691983312 12691975496 12691983100 ONLINE
6 rows selected.
SYS@test> SELECT file#, CHECKPOINT_CHANGE#, CREATION_CHANGE# , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy FROM v$datafile_header;
FILE# CHECKPOINT_CHANGE# CREATION_CHANGE# RESETLOGS_CHANGE# STATUS CHECKPOINT_COUNT FUZ
------------ ------------------ ---------------- ----------------- ---------- ---------------- ---
1 12691983312 5 12691748925 ONLINE 868465271 NO
2 12691983312 600647 12691748925 ONLINE 868465271 NO
3 12691983312 6678 12691748925 ONLINE 868465271 NO
4 12691983312 10685 12691748925 ONLINE 868465274 NO
5 12691983312 625439 12691748925 ONLINE 868465271 NO
6 12690915328 11997383136 12691748925 ONLINE 292 NO
6 rows selected.
SYS@test> alter database open ;
alter database open
*
ERROR at line 1:
ORA-00600: internal error code, arguments: [3619], [1], [0], [], [], [], [], []
SYS@test> select open_mode from v$database ;
OPEN_MODE
----------
MOUNTED
SYS@test> recover datafile 6;
ORA-00283: recovery session canceled due to errors
ORA-00600: internal error code, arguments: [2608], [2], [2], [4100980736], [2], [4102000729], [], []
--第2个参数2,标识log group#(我猜测的)
--第3个参数wrap,第4个参数base scn. 文件头CHECKPOINT_CHANGE#.
--第5个参数wrap,第6个参数base scn. 这个值是log group# =2 ,FIRST_CHANGE#.
2^33+4100980736=12690915328
2^33+4102000729=12691935321
4.还原现场:
BBED> set dba 6,1
DBA 0x01800001 (25165825 6,1)
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0xf4700000
BBED> modify /x d04b
..
BBED> set offset +2
OFFSET 486
BBED> modify /x 80f4
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0xf4804bd0
BBED> sum apply ;
Check value for File 6, Block 1:
current = 0x254d, required = 0x254d
SYS@test> SELECT file#, CHECKPOINT_CHANGE#, UNRECOVERABLE_CHANGE# ,LAST_CHANGE#, OFFLINE_CHANGE#, ONLINE_CHANGE#,status FROM v$datafile;
FILE# CHECKPOINT_CHANGE# UNRECOVERABLE_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ONLINE_CHANGE# STATUS
------------ ------------------ --------------------- ------------ --------------- -------------- ----------
1 12691983312 0 12691983312 0 0 SYSTEM
2 12691983312 0 12691983312 0 0 ONLINE
3 12691983312 0 12691983312 0 0 ONLINE
4 12691983312 0 12691983312 0 0 ONLINE
5 12691983312 0 12691983312 0 0 ONLINE
6 12691983312 0 12691983312 12691975496 12691983100 ONLINE
6 rows selected.
SYS@test> SELECT file#, CHECKPOINT_CHANGE#, CREATION_CHANGE# , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy FROM v$datafile_header;
FILE# CHECKPOINT_CHANGE# CREATION_CHANGE# RESETLOGS_CHANGE# STATUS CHECKPOINT_COUNT FUZ
------------ ------------------ ---------------- ----------------- ---------- ---------------- ---
1 12691983312 5 12691748925 ONLINE 868465271 NO
2 12691983312 600647 12691748925 ONLINE 868465271 NO
3 12691983312 6678 12691748925 ONLINE 868465271 NO
4 12691983312 10685 12691748925 ONLINE 868465274 NO
5 12691983312 625439 12691748925 ONLINE 868465271 NO
6 12691983312 11997383136 12691748925 ONLINE 292 NO
6 rows selected.
SYS@test> shutdown immediate ;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SYS@test> startup mount
ORACLE instance started.
Total System Global Area 473956352 bytes
Fixed Size 2084776 bytes
Variable Size 260046936 bytes
Database Buffers 201326592 bytes
Redo Buffers 10498048 bytes
Database mounted.
SYS@test> alter database open ;
Database altered.
SYS@test> select * from scott.deptx;
DEPTNO DNAME LOC
------------ -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON