人为构造system回滚段错误一例

| No Comments

这个例子是我在了解undo block的结构的时候顺便做的一个例子。

在这个例子里,我通过手工修改ktuxcfbp[0]. kubadba,人为构造出来了ORA-600 [4193]错误

 

如下是整个构造过程:

SQL> conn dras/astca@astcatest;

Connected to Oracle9i Enterprise Edition Release 9.2.0.6.0

Connected as dras

 

SQL> select HEADER_FILE,HEADER_BLOCK from dba_segments where segment_name='SYSTEM';

 

HEADER_FILE HEADER_BLOCK

----------- ------------

          1            9

 

我们现在dump 1-9这个blockdump出来的内容如下:

Start dump data blocks tsn: 0 file#: 1 minblk 9 maxblk 9

buffer tsn: 0 rdba: 0x00400009 (1/9)

scn: 0x0008.a9f7d8fc seq: 0x01 flg: 0x04 tail: 0xd8fc0e01

frmt: 0x02 chkval: 0x6cf3 type: 0x0e=KTU UNDO HEADER W/UNLIMITED EXTENTS

  Extent Control Header

  -----------------------------------------------------------------

  Extent Header:: spare1: 0      spare2: 0      #extents: 6      #blocks: 47   

                  last map  0x00000000  #maps: 0      offset: 4128 

      Highwater::  0x004001a0  ext#: 5      blk#: 7      ext size: 8    

  #blocks in seg. hdr's freelists: 0     

  #blocks below: 0    

  mapblk  0x00000000  offset: 5    

                   Unlocked

     Map Header:: next  0x00000000  #extents: 6    obj#: 0      flag: 0x40000000

  Extent Map

  -----------------------------------------------------------------

   0x0040000a  length: 7    

   0x00400011  length: 8    

   0x00400181  length: 8    

   0x00400189  length: 8    

   0x00400191  length: 8    

   0x00400199  length: 8    

 

  TRN CTL:: seq: 0x0035 chd: 0x0060 ctl: 0x0002 inc: 0x00000000 nfb: 0x0001

            mgc: 0x8002 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)

            uba: 0x004001a0.0035.15 scn: 0x0008.a9e6062f

Version: 0x01

  FREE BLOCK POOL::

    uba: 0x004001a0.0035.15 ext: 0x5  spc: 0xccc  

    uba: 0x00000000.0032.07 ext: 0x2  spc: 0x1d08 

    uba: 0x00000000.0030.3e ext: 0x0  spc: 0x476  

    uba: 0x00000000.0000.00 ext: 0x0  spc: 0x0    

    uba: 0x00000000.0000.00 ext: 0x0  spc: 0x0    

  TRN TBL::

  ......后续内容省略

 

我们现在把上述free block pool中的0x004001a0改成0x004001a1

shutdown上述数据库,然后就可以动手改了:

$ bbed parfile=par.bbd

Password:

 

BBED: Release 2.0.0.0.0 - Limited Production on Wed May 6 15:40:46 2009

 

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

 

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

 

BBED> set file 1

        FILE#           1

 

BBED> set block 9

        BLOCK#          9

 

BBED> p ktuxc

struct ktuxc, 104 bytes                     @4148   

   struct ktuxcscn, 8 bytes                 @4148   

      ub4 kscnbas                           @4148     0xa9e60631

      ub2 kscnwrp                           @4152     0x0008

   struct ktuxcuba, 8 bytes                 @4156   

      ub4 kubadba                           @4156     0x004001a0

      ub2 kubaseq                           @4160     0x0035

      ub1 kubarec                           @4162     0x16

   sb2 ktuxcflg                             @4164     1 (KTUXCFSK)

   ub2 ktuxcseq                             @4166     0x0035

   sb2 ktuxcnfb                             @4168     1

   ub4 ktuxcinc                             @4172     0x00000000

   sb2 ktuxcchd                             @4176     81

   sb2 ktuxcctl                             @4178     96

   ub2 ktuxcmgc                             @4180     0x8002

   ub4 ktuxcopt                             @4188     0x7ffffffe

   struct ktuxcfbp[0], 12 bytes             @4192   

      struct ktufbuba, 8 bytes              @4192   

         ub4 kubadba                        @4192     0x004001a0

         ub2 kubaseq                        @4196     0x0035

         ub1 kubarec                        @4198     0x1f

      sb2 ktufbext                          @4200     5

      sb2 ktufbspc                          @4202     1296

   struct ktuxcfbp[1], 12 bytes             @4204   

      struct ktufbuba, 8 bytes              @4204   

         ub4 kubadba                        @4204     0x00000000

         ub2 kubaseq                        @4208     0x0032

         ub1 kubarec                        @4210     0x07

      sb2 ktufbext                          @4212     2

      sb2 ktufbspc                          @4214     7432

   struct ktuxcfbp[2], 12 bytes             @4216   

      struct ktufbuba, 8 bytes              @4216   

         ub4 kubadba                        @4216     0x00000000

         ub2 kubaseq                        @4220     0x0030

         ub1 kubarec                        @4222     0x3e

      sb2 ktufbext                          @4224     0

      sb2 ktufbspc                          @4226     1142

   struct ktuxcfbp[3], 12 bytes             @4228   

      struct ktufbuba, 8 bytes              @4228   

         ub4 kubadba                        @4228     0x00000000

         ub2 kubaseq                        @4232     0x0000

         ub1 kubarec                        @4234     0x00

      sb2 ktufbext                          @4236     0

      sb2 ktufbspc                          @4238     0

   struct ktuxcfbp[4], 12 bytes             @4240    

      struct ktufbuba, 8 bytes              @4240   

         ub4 kubadba                        @4240     0x00000000

         ub2 kubaseq                        @4244     0x0000

         ub1 kubarec                        @4246     0x00

      sb2 ktufbext                          @4248     0

      sb2 ktufbspc                          @4250     0

 

BBED> set offset 4192

        OFFSET          4192

 

BBED> dump

 File: /dras11/oradata/astca/system01.dbf (1)

 Block: 9                Offsets: 4192 to 4703           Dba:0x00400009

------------------------------------------------------------------------

 004001a0 00351f00 00050510 00000000 00320700 00021d08 00000000 00303e00

 00000476 00000000 00000000 00000000 00000000 00000000 00000000 0000002d

 0040019e a9e7d39a 00085e38 0900001a 00000000 00000000 00000000 00000001

 00000000 0000002d 0040019d a9e7d38a 00085e38 09000005 00000000 00000000

 00000000 00000001 00000000 0000002e 004001a0 a9f7d8fc 00085e38 09000060

 00000000 00000000 00000000 00000001 00000000 0000002d 0040019e a9f46b87

 00085e38 09000012 00000000 00000000 00000000 00000001 00000000 0000002d

 0040019e a9f46b7d 00085e38 09000023 00000000 00000000 00000000 00000001

 00000000 0000002d 0040019d a9e7d38b 00085e38 0900000a 00000000 00000000

 00000000 00000001 00000000 0000002d 0040019d a9e60649 00085e38 09000055

 00000000 00000000 00000000 00000001 00000000 0000002d 0040019f a9f7d754

 00085e38 09000032 00000000 00000000 00000000 00000001 00000000 0000002d

 0040019d a9e7d396 00085e38 09000015 00000000 00000000 00000000 00000001

 00000000 0000002d 0040019d a9e7d387 00085e38 0900005a 00000000 00000000

 00000000 00000001 00000000 0000002d 0040019d a9e7d38c 00085e38 0900004f

 00000000 00000000 00000000 00000001 00000000 0000002d 0040019e a9f46b75

 

 <32 bytes per line>

 

BBED> modify /x 004001a1

Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y

 File: /dras11/oradata/astca/system01.dbf (1)

 Block: 9                Offsets: 4192 to 4703           Dba:0x00400009

------------------------------------------------------------------------

 004001a1 00351f00 00050510 00000000 00320700 00021d08 00000000 00303e00

 00000476 00000000 00000000 00000000 00000000 00000000 00000000 0000002d

 0040019e a9e7d39a 00085e38 0900001a 00000000 00000000 00000000 00000001

 00000000 0000002d 0040019d a9e7d38a 00085e38 09000005 00000000 00000000

 00000000 00000001 00000000 0000002e 004001a0 a9f7d8fc 00085e38 09000060

 00000000 00000000 00000000 00000001 00000000 0000002d 0040019e a9f46b87

 00085e38 09000012 00000000 00000000 00000000 00000001 00000000 0000002d

 0040019e a9f46b7d 00085e38 09000023 00000000 00000000 00000000 00000001

 00000000 0000002d 0040019d a9e7d38b 00085e38 0900000a 00000000 00000000

 00000000 00000001 00000000 0000002d 0040019d a9e60649 00085e38 09000055

 00000000 00000000 00000000 00000001 00000000 0000002d 0040019f a9f7d754

 00085e38 09000032 00000000 00000000 00000000 00000001 00000000 0000002d

 0040019d a9e7d396 00085e38 09000015 00000000 00000000 00000000 00000001

 00000000 0000002d 0040019d a9e7d387 00085e38 0900005a 00000000 00000000

 00000000 00000001 00000000 0000002d 0040019d a9e7d38c 00085e38 0900004f

 00000000 00000000 00000000 00000001 00000000 0000002d 0040019e a9f46b75

 

 <32 bytes per line>

 

BBED> sum apply

Check value for File 1, Block 9:

current = 0x758c, required = 0x758c

 

好了,我们已经改完了,现在我们startup上述数据库,来看一下改动后的效果:

$ sqlplus '/ as sysdba';

 

SQL*Plus: Release 9.2.0.6.0 - Production on Wed May 6 15:46:59 2009

 

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

 

Connected to an idle instance.

 

 

SQL_astca>startup

ORACLE instance started.

 

Total System Global Area  824150304 bytes

Fixed Size                   743712 bytes

Variable Size             285212672 bytes

Database Buffers          536870912 bytes

Redo Buffers                1323008 bytes

Database mounted.

ORA-01092: ORACLE instance terminated. Disconnection forced

 

可以看到,上述数据库现在已经起不来了,我们现在去alert log里看一下具体的错误原因:

$ tail -n 10 alert_astca.log

  Mem# 1 errs 0: /dras11/oradata/astca/redo03b.log

Wed May  6 15:47:07 2009

Errors in file /cadrasu01/app/oracle/admin/astca/udump/astca_ora_8933512.trc:

ORA-00604: error occurred at recursive SQL level 1

ORA-00607: Internal error occurred while making a change to a data block

ORA-00600: internal error code, arguments: [4193], [46], [53], [], [], [], [], []

Error 604 happened during db open, shutting down database

USER: terminating instance due to error 604

Instance terminated by USER, pid = 8933512

ORA-1092 signalled during: ALTER DATABASE OPEN...

 

可以看到,我们已经达到了目的,成功构造出了ORA-600 [4193]错误

Leave a comment