ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Redo内部解析(二)

Redo内部解析(二)

原创 Linux操作系统 作者:yezhibin 时间:2009-06-24 12:37:58 0 删除 编辑
五、DUMP Redo 命令格式

 1、DUMP日志文件内容

        SQL>alter system dump logfile 'pathname'

 2、Dump 指定一段数据文件块日志文件

        SQL>alter system dump logfile 'pathname'
                   DBA  Min .
                   DBA  MAX .

 3、Dump 指定RBA(REDO BYTE ADDRESS)日志文件

        SQL>alter system dump logfile 'pathname'
                  RBA MIN.
                  RBA MAX.

 4、具体的LAYER和Opcode(操作代码)
      
        SQL>alter system dump logfile 'pathname'
                  LAYER
                  OPCODE

  5、SCN
         SQL>alter system dump logfile 'pathname'
                   SCN MIN min_scn
                   SCN MAX max_scn

   6、DUMP Redo 日志文件头

        SQL>alter session set events 'immediate trace name redohdr level xx'
     或SQL>oradebug dump redohdr level xx
        Level说明:
                 1-- 从控制文件中Dump redo log记录
                 2-- Level 1 + generic file header
                 3-- level 2 + log file header
                10-- same as level 3

说明:dump 日志所用SCN的十进制,具体计算如下:
         
                time=(((((yyyy - 1988)) * 12 + mm - 1) * 31 + dd - 1) * 24 + hh)
                           * 60 + mi) * 60 + ss;
         
                 其中mm: 01~12
                         dd: 01~31
                         hh: 01~23
                         mi: 00~59
                         ss: 00~59
 
六、DUMP数据格式说明

1、redo records dump文件格式说明

       SQL> create table test.test (id number, test varchar(20));
      
       SQL>insert into test.test values('1', 'TEST1');
       SQL>commit;
      
       SQL>select   SEGMENT_NAME,
                               FILE_ID ,
                               BLOCK_ID,
                               BLOCKS,
                               RELATIVE_FNO 
                  from dba_extents
                  where segment_name='TEST' and wner='TEST';

SEGMENT_NAME   FILE_ID   BLOCK_ID     BLOCKS RELATIVE_FNO
------------------------------ ---------- ---------- ---------- ------------
    TEST                                8          9                            8            8
      
        SQL>Alter system dump logfile '/home/oracle/app/oradata/orcl/redo0301.log'
                   dba min 8 9
                   dba max 8 16
           
节选一段格式说明:
REDO RECORD - Thread:1 RBA: 0x000015.0006dc4e.0010 LEN: 0x01e0 VLD: 0x0d SCN: 0x0000.0035c4b9 SUBSCN:  3 06/25/2009 15:38:39

RBA:..

LEN:16进制的redo records长度,如0x01e0 =480 bytes


SCN:16进制,RBA改变的时间,如0x0000.0035c4b9


SUBSCN:在SCN下的顺序


CHANGE #1 TYP:2 CLS: 1 AFN:8 DBA:0x0200000f OBJ:49577 SCN:0x0000.00353ef6 SEQ:  1 OP:11.2
KTB Redo
op: 0x01  ver: 0x01
op: F  xid:  0x000a.007.000002d2    uba: 0x00c018c3.00c6.2d
KDO Op code: IRP row dependencies Disabled
  xtype: XA flags: 0x00000000  bdba: 0x0200000f  hdba: 0x0200000b
itli: 2  ispac: 0  maxfr: 4858
tabn: 0 slot: 1(0x1) size/delt: 12

TYP:  0 - normal,1- new block, 2 - delayed logging

CLS:  block类型,除了undo block/undo header类型外,与x$bh.class相同

             1 -- Data Block
             2 -- Sort Block
             3 -- Deffered Undo Segment Blocks
             4 -- Segment Header Block (Table)
             5 -- Deffered Undo Segment Header Blocks
             6 -- Free List Block
             7 -- Extent Map Blocks
             8 -- Space Management Bitmap Blocks
             9 -- Space Management Index Blocks
            10-- Unused
            11+2r -- Segment Header for undo segment r
            12+2r -- Data blocks for undo Segment r

AFN:  文件编号


DBA:  data block address, 如0200000f,以下是将DBA对应file#和block#

          SQL>select to_number('200000f', 'xxxxxxx') from dual;
                        TO_NUMBER('200000F','XXXXXXXX')
                       -------------------------------
                                  33554447
          SQL>select dbms_utility.data_block_address_file('33554447')  file_id,
                                dbms_utility.data_block_address_block('33554447')  blok_id
                     from dual;
                            FILE_ID    BLOK_ID
                              ---------- ----------
                                     8         15

: block version


OP:  layer.opcode 操作代码,详细的对应关系见后面介绍,11.2表示insert


xid:  当前的事务处理ID,usn#.slot#.wrap#,其中usn#: undo segment  number; slot#: 事务slot编号; wrap# sequence编号

UBA: 在undo block发生改变的地址如uba: 0x00c018c3.00c6.2d
                undo 数据块地址:00c018c3
                Sequence Number: 00c6
                Record number: 4

KDO undo record:
KTB Redo
op: 0x03  ver: 0x01
op: Z
KDO Op code: DRP row dependencies Disabled
  xtype: XA flags: 0x00000000  bdba: 0x0200000f  hdba: 0x0200000b
itli: 2  ispac: 0  maxfr: 4858
tabn: 0 slot: 1(0x1)

表示undo编号的change vector,undo发生的变化是对应DBA 0x0200000f ,slot 1
 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/354732/viewspace-607412/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-12-18

  • 博文量
    159
  • 访问量
    508379