模拟ORA-600 [4000] 并修复

联系:QQ(5163721)

标题:模拟ORA-600 [4000] 并修复

作者:Lunar©版权所有[文章允许转载,但必须以链接方式注明源地址,否则追究法律责任.]

我没有测试,但是我感觉,从一个好的库上直接dd一个file 1 block 520,可能也可以的,O(∩_∩)O哈哈~
我这里使用了bbed去修改文件,生产库请勿效仿,后果自负 :)
模拟ORA-600 [4000]:

SYS@bb>Alter session set events '10912 trace name context forever, level 1';

Session altered.

SYS@bb>exec dbms_space_admin.tablespace_fix_segment_extblks('SYSTEM');

PL/SQL procedure successfully completed.

SYS@bb>shutdown abort
ORACLE instance shut down.
SYS@bb>startup
ORACLE instance started.

Total System Global Area  367439872 bytes
Fixed Size                  2228464 bytes
Variable Size             134221584 bytes
Database Buffers          226492416 bytes
Redo Buffers                4497408 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
Process ID: 15101
Session ID: 125 Serial number: 5


SYS@bb>

查看alert:

SMON: enabling cache recovery
Errors in file /u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc  (incident=14537):
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
Incident details in: /u01/app/oracle/diag/rdbms/bb/bb/incident/incdir_14537/bb_ora_15101_i14537.trc
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Errors in file /u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc:
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
Errors in file /u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc:
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
Error 704 happened during db open, shutting down database
USER (ospid: 15101): terminating the instance due to error 704
Instance terminated by USER, pid = 15101
ORA-1092 signalled during: ALTER DATABASE OPEN...
opiodr aborting process unknown ospid (15101) as a result of ORA-1092
Sun Oct 27 21:55:58 2013
ORA-1092 : opitsk aborting process

查看trace:

[root@lunar ~]# vi /u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc
Trace file /u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/11.2.0.3/dbhome_1
System name:    Linux
Node name:      lunar
Release:        2.6.32-300.10.1.el5uek
Version:        #1 SMP Wed Feb 22 17:37:40 EST 2012
Machine:        x86_64
Instance name: bb
Redo thread mounted by this instance: 1
Oracle process number: 17
Unix process pid: 15101, image: oracle@lunar (TNS V1-V3)


*** 2013-10-27 21:55:50.765
*** SESSION ID:(125.5) 2013-10-27 21:55:50.765
*** CLIENT ID:() 2013-10-27 21:55:50.765
*** SERVICE NAME:() 2013-10-27 21:55:50.765
*** MODULE NAME:(sqlplus@lunar (TNS V1-V3)) 2013-10-27 21:55:50.765
*** ACTION NAME:() 2013-10-27 21:55:50.765

Successfully allocated 2 recovery slaves
Using 67 overflow buffers per recovery slave
Thread 1 checkpoint: logseq 35, block 2, scn 577686
  cache-low rba: logseq 35, block 375
    on-disk rba: logseq 35, block 3679, scn 582875
  start recovery at logseq 35, block 375, scn 0

*** 2013-10-27 21:55:50.776
"/u01/app/oracle/diag/rdbms/bb/bb/trace/bb_ora_15101.trc" 85L, 3189C
KCRA: blocks processed = 1733/1733, claimed = 1733, eliminated = 0

*** 2013-10-27 21:55:50.839
Recovery of Online Redo Log: Thread 1 Group 2 Seq 35 Reading mem 0

*** 2013-10-27 21:55:50.856
Completed redo application of 1.23MB

*** 2013-10-27 21:55:52.664
Completed recovery checkpoint
----- Recovery Hash Table Statistics ---------
Hash table buckets = 262144
Longest hash chain = 1
Average hash chain = 1733/1733 = 1.0
Max compares per lookup = 1
Avg compares per lookup = 11220/11234 = 1.0
----------------------------------------------
Recovery sets nab of thread 1 seq 35 to 3679 with 8 zeroblks

*** 2013-10-27 21:55:54.685
Incident 14537 created, dump file: /u01/app/oracle/diag/rdbms/bb/bb/incident/incdir_14537/bb_ora_15101_i14537.trc
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []

ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []

*** 2013-10-27 21:55:56.922
USER (ospid: 15101): terminating the instance due to error 704
[root@lunar ~]# 


dbkedDefDump(): Starting incident default dumps (flags=0x2, level=3, mask=0x0)
----- Current SQL Statement for this session (sql_id=6apq2rjyxmxpj) -----
select line#, sql_text from bootstrap$ where obj# != :1  ===========注意这个是当前报错的语句,注意到是bootstrap$


SYS@bb>startup restrict pfile=/tmp/a.ora
ORACLE instance started.

Total System Global Area  367439872 bytes
Fixed Size                  2228464 bytes
Variable Size             134221584 bytes
Database Buffers          226492416 bytes
Redo Buffers                4497408 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [3], [], [], [], [], [], [], [], [], [], []
Process ID: 15215
Session ID: 125 Serial number: 5


SYS@bb>

trace中其他有用的信息如下:

PINNED BUFFER HISTORY (oldest pin first)
---------------------
BH (0x6dfea308) file#: 1 rdba: 0x00400208 (1/520) class: 4 ba: 0x6ddec000
  set: 6 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 0,0
  dbwrid: 0 obj: 59 objn: 59 tsn: 0 afn: 1 hint: f
  hash: [0x6dffc6a8,0x74bda248] lru: [0x745e01f8,0x745e01f8]
  ckptq: [NULL] fileq: [NULL] objq: [0x70c773a8,0x70c773a8] objaq: [0x70c77398,0x70c77398]
  st: XCURRENT md: NULL fpin: 'ktewh25: kteinicnt' tch: 1
  flags:
  LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [65535]
  buffer tsn: 0 rdba: 0x00400208 (1/520)
  scn: 0x0000.0008d28a seq: 0x01 flg: 0x04 tail: 0xd28a1001
  frmt: 0x02 chkval: 0xe5c5 type: 0x10=DATA SEGMENT HEADER - UNLIMITED
Hex dump of block: st=0, typ_found=1

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。


  Extent Control Header
  -----------------------------------------------------------------
  Extent Header:: spare1: 0      spare2: 0      #extents: 1      #blocks: 7
                  last map  0x00000000  #maps: 0      offset: 4128
      Highwater::  0x0040020c  ext#: 0      blk#: 3      ext size: 7
  #blocks in seg. hdr's freelists: 1
  #blocks below: 3
  mapblk  0x00000000  offset: 0
      Disk Lock:: Locked by xid:  0x0003.00c.00000180           注意这里,有一个事物,这个表被加了锁
     Map Header:: next  0x00000000  #extents: 1    obj#: 59     flag: 0x40000000
  Extent Map
  -----------------------------------------------------------------
   0x00400209  length: 7
 
  nfl = 1, nfb = 1 typ = 1 nxf = 0 ccnt = 3
  SEG LST:: flg: USED   lhd: 0x0040020b ltl: 0x0040020b
BH (0x6dffc5f8) file#: 1 rdba: 0x00400208 (1/520) class: 4 ba: 0x6dfd6000
  set: 5 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 0,0
  dbwrid: 0 obj: -2 objn: -1 tsn: 0 afn: 1 hint: f
  hash: [0x74bda248,0x6dfea3b8] lru: [0x745dfaf8,0x745dfaf8]
  ckptq: [NULL] fileq: [NULL] objq: [NULL] objaq: [NULL]
  st: CR md: NULL tch: 1
  cr: [scn: 0x0.1],[xid: 0x0.0.0],[uba: 0x0.0.0],[cls: 0x0.ab9bb],[sfl: 0x0],[lc: 0x0.0]
  flags:
  buffer tsn: 0 rdba: 0x00400208 (1/520)
  scn: 0x0000.0008d28a seq: 0x01 flg: 0x04 tail: 0xd28a1001
  frmt: 0x02 chkval: 0xe5c5 type: 0x10=DATA SEGMENT HEADER - UNLIMITED
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x000000006DFD6000 to 0x000000006DFD8000
06DFD6000 0000A210 00400208 0008D28A 04010000  [......@.........]


。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

  Extent Control Header
  -----------------------------------------------------------------
  Extent Header:: spare1: 0      spare2: 0      #extents: 1      #blocks: 7
                  last map  0x00000000  #maps: 0      offset: 4128
      Highwater::  0x0040020c  ext#: 0      blk#: 3      ext size: 7
  #blocks in seg. hdr's freelists: 1
  #blocks below: 3
  mapblk  0x00000000  offset: 0
      Disk Lock:: Locked by xid:  0x0003.00c.00000180  
     Map Header:: next  0x00000000  #extents: 1    obj#: 59     flag: 0x40000000
  Extent Map
  -----------------------------------------------------------------
   0x00400209  length: 7

  nfl = 1, nfb = 1 typ = 1 nxf = 0 ccnt = 3
  SEG LST:: flg: USED   lhd: 0x0040020b ltl: 0x0040020b

The buffer with tsn: 0 rdba: 0x00400208 has already been dumped

摘要上面的信息,有用的如下:

rdba: 0x00400208 (1/520)  =============》说明root dba是file 1 block 520
Extent Header:: spare1: 0      spare2: 0      #extents: 1      #blocks: 7
Disk Lock:: Locked by xid:  0x0003.00c.00000180      ==============》被锁的事物的xid,转换成10进制是:3.12.384 ,这里跟报错信息匹配了,是回滚段3,事物槽是12,wrap是384
obj#: 59
  scn: 0x0000.0008d28a seq: 0x01 flg: 0x04 tail: 0xd28a1001

obj# 59是 bootstrap$表

下面清除锁标识:

[oracle@lunar bbed]$ bbed parfile=bbed.par

BBED: Release 2.0.0.0.0 - Limited Production on Sun Oct 27 23:17:33 2013

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

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

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

BBED> 
BBED> set offset 88
        OFFSET          88
BBED> m /x 00000000
 File: /u01/app/oracle/oradata/bb/system01.dbf (1)
 Block: 520              Offsets:   88 to  599           Dba:0x00400208
------------------------------------------------------------------------
 00000000 01000000 00000000 3b000000 00000040 09024000 07000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

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

BBED> 

成功打开数据库:

[oracle@lunar trace]$ ss

SQL*Plus: Release 11.2.0.3.0 Production on Sun Oct 27 23:30:54 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Real Application Testing options

SYS@bb>alter database open;

Database altered.

SYS@bb>archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/arch
Oldest online log sequence     41
Current log sequence           43
SYS@bb>
此条目发表在 backup&recovery, ORA-600/7445 分类目录,贴了 , 标签。将固定链接加入收藏夹。

模拟ORA-600 [4000] 并修复》有 4 条评论

  1. 老代 说:

    看完要回复,没太看懂

  2. Lunar 说:

    哪里看不懂啊,小travel都照着这个做出来了,还写了blog,O(∩_∩)O哈哈~

  3. 叶桦 说:

    能问下set offset 88 是怎么来的吗

  4. Kelvin 说:

    谢谢Lunar女神文章,使我获益良多,我是一直看着Lunar女神文章长大的

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注