0

0

oracle redo log 分析

php中文网

php中文网

发布时间:2016-06-07 15:44:36

|

1510人浏览过

|

来源于php中文网

原创

Environment: OS: Ubuntu 10.10 Oracle: 11.1.0.6.0 Test table: test_user SQL desc test_user; Name Null? Type ----------------------------------------- -------- ---------------------------- ID NUMBER(38) NAME VARCHAR2(20) Current data: SQL s

 

eSiteGroup站群管理系统1.0.4
eSiteGroup站群管理系统1.0.4

eSiteGroup站群管理系统是基于eFramework低代码开发平台构建,是一款高度灵活、可扩展的智能化站群管理解决方案,全面支持SQL Server、SQLite、MySQL、Oracle等主流数据库,适配企业级高并发、轻量级本地化、云端分布式等多种部署场景。通过可视化建模与模块化设计,系统可实现多站点的快速搭建、跨平台协同管理及数据智能分析,满足政府、企业、教育机构等组织对多站点统一管控的

下载

Environment:

OS: Ubuntu 10.10

Oracle: 11.1.0.6.0

 

 

Test table: test_user

Current data:

Operation:

 

Log File Dumps:

Symbolic dumps can be created for both online redo logs and archived redo logs using the following syntax:

For online redo logs the filename of the current redo log can be obtained using the following SQL:

Output dump file can be found with this command:

if ASM, use following command

SQL> oradebug setmypid;
Statement processed.
SQL> oradebug tracefile_name;
/u02/app/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_20221.trc

Find the detail log info we just operated in dump file:

1. find the object id of the table

2. find log in dump file based on "object_id" and operation time.The  redo infomation as follows, note the "OBJ:71329" and the timestap "12/21/2010

 

 

Redo Log Analysis:

 

Redo Records Structure:

oracle redo log 分析

 

Reo Record Header

 

  • Thread - redo log thread number

              value: 1

  • RBA - redo byte address - address of redo record within redo log. Format is ..

              value: 0x00007.00012d3d.0010

                  sequence_number:  0x00007

                  block_number: 0x00012d3d

                  offset: 0x10


  • LEN - length of redo record in bytes including header

              value: 0x22c             

  • VLD -

              The VLD field determines the size of the redo record header. Known values are shown in the following table. These values may vary from one release to another.

 

 
Mnemonic Value Description
KCRVOID 0 The contents are not valid
KCRVALID 1 Includes change vectors
KCRDEPND 2 Includes commit SCN
KCRVOID 4 Includes dependent SCN
KCRNMARK 8 New SCN mark record. SCN allocated exactly at this point in the redo log by this instance
KCROMARK 16 Old SCN mark record. SCN allocated at or before this point in the redo. May be allocated by another instance
KCRORDER 32 New SCN was allocated to ensure redo for some block would be ordered by inc/seq# when redo sorted by SCN

              value: 0x0d  -  1101: "Includes change vectors" & "Includes dependent SCN" &  "New SCN mark record. SCN allocated exactly at this point in the redo log by this instance"

  • SCN - system change number of redo record

              value: 0x0000.000fddbd

  • SUBSCN: Unknown

              value: 1

  • Timestamp

              value: 12/21/2010 16:30:29

 

Change #1:

 

Change Header:

  • TYP - change type

              value: 2

  • CLS - class

 

 
Class Description
1 Data Block
2 Sort Block
3 Deferred Undo Segment Blocks
4 Segment Header Block (Table)
5 Deferred Undo Segment Header Blocks
6 Free List Blocks
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

          value: 1  -  mean data block

  • AFN - Absolute File No

              get file info using this sql statement:

             

              value: 4  - means to "users01.dbf"

  • DBA - Database Block Address

              value: 0x01000195

                  File No: 4

                  Block No: 0x195

  • OBJ - object

              value: 71329

  • SCN - System change Number

              value: 0x0000.000fdd5e

                  wrap: 0x0000

                  base:  0xfdd5e

  • SEQ - Sequence Number

              value: 2

  • OP - Operation Code

 

Each change vector has an operation code. In Oracle 9.2 there were over 150 redo log operations; this number has grown significantly in Oracle 10.2 though the exact figure is not known. The operation code consists of a major number and a minor number.

The major number describes the level in the kernel where the redo is generated. The following table shows common levels:

 
Level Description
4 Block Cleanout
5 Transaction Layer (Undo)
10 Index Operation
11 Table Operation (DML)
13 Block Allocation
14 Extent Allocation
17 Backup Management
18 Online Backup
19 Direct Load
20 Transaction Metadata (LogMiner)
22 Space Management (ASSM)
23 Block Write (DBWR)
24 DDL Statement

              For "Table Operation(DML)", description as follows:

 

 
Code Mnemonic Description
11.1 IUR Undo
11.2 IRP Insert Row Piece
11.3 DRP Delete Row Piece
11.4 LKR Lock Row
11.5 URP Update Row Piece
11.6 ORP Overflow Row Piece
11.7 MFC  
11.8 CFA  
11.9 CKI  
11.10 SKL  
11.11 QMI Insert Row Array
11.12 QMD Delete Row Array
11.14 DSC  
11.16 LMN  
11.17 LLB  
11.19 19 Update Row Array
11.20 SHK  
11.21 21  

 

For "Transaction Layer (Undo)", description as follows:

 
Code Mnemonic Description
5.1 1 Undo Recorder
5.2 2 Undo Header
5.4 4 Commit

 

              values: 11.19

 

KTB Redo

KTB Redo records modifications to the transaction header of a block. The inverse operations are recorded in the undo segment

Each KTB Redo record has an operation type. Known codes include:

 
Numeric Code Alphanumeric Code
0x1 F
0x2 C
0x3 Z
0x4 L
0x5 R
0x11 F
  • op: 0x01 - Numeric Code
  • ver: 0x01
  • op: F - Alphanumeric Code
  • xid: Transaction ID. Format is usn#.slot#.wrap# Components are:

     
    usn# Undo segment number
    slot# Slot number in undo segment
    wrap# Sequence number

    value: 0x000a.005.0000035a

        usn: 0x000a

        slot: 0x005

        wrap: 0x0000035a

  • uba: uba Undo block address. Format is dba.seq#.rec# Components are:
     
    dba Data block address of undo block
    seq# Sequence number of undo block
    rec# Record number within undo block

            value: 0x00c00478.01ca.28

                dba: 0x00c00478

                seq: 0x01ca

                rec:  0x28

 

  • tabn - specifies the table number. For non-clustered tables this will always be 0
  • slot - specifies the slot number. Each block has an variable length array of slots. Each element in this array specifies the location of a row within the block. The first slot in the block is 0. In this example the row was written to the third  slot in the table (slot 2)
  • flag - Unknown
  • lock - probably set to 1 indicating a lock has been taken on the row header, what's the mean 2?
  • ckix - Unknown

  • ncol - Number of columns in row piece
  • nnew - Number of changed columns in row piece
  • size - (Probably) change in size of row piece

  • Operation code: Update Row Piece
  • row dependencies - specifies whether row dependencies are disabled (default) or enabled for this table

  • xtype - transaction type. Can be XA, XR, CR or KDO_KDOM2. In this case the transaction type is KDO_KDOM2. This structure can potentially store an array of change vectors for an object.
  • flags - Unknown
  • bdba - block DBA. Data block address of this block
  • hdba - header DBA. Probably data block address of extent header

 

  • itli - specifes the ITL slot number of the transaction performing the operation. In this example the row is locked by the transaction in the first ITL slot.
  • ispac - Unknown
  • maxfr - Unknown

Update of column 1 (name) to 'ddd'

 

Change #2:

Change header:

  • TYP:  0
  • CLS: 35
  • AFN: 3  - refer to "undotbs01.dbf"
  • DBA: 0x00c00099
  • OBJ:  4294967259
  • SCN: 0x0000.000fdd85
  • SEQ: 1
  • OP: 5.2  -  means "Undo header"

Change body:

 

Change #3:

Change header:

  • TYP:  0
  • CLS: 35
  • AFN: 3  - refer to "undotbs01.dbf"
  • DBA: 0x00c00039
  • OBJ:  4294967295
  • SCN: 0x0000.000fddc3
  • SEQ: 1
  • OP: 5.4  -  means "Commit"

Change #4:

Change header:

  • TYP:  0
  • CLS: 24
  • AFN: 3  - refer to "undotbs01.dbf"
  • DBA: 0x00c005ba
  • OBJ:  4294967295
  • SCN: 0x0000.000fdd8a
  • SEQ: 3
  • OP: 5.1  -  means "Undo Recorder"

Change Body:

  • logon user: 106 - current user id, confirmed as follows:

 

RollBack:

Opration:

Redo Log:

 

Update Multiple rows:

Operation:

Redo Log:

 

Multi Operation One Commit:

operation:

Redo Log:

 

Reference:

http://www.juliandyke.com/Internals/Redo/Redo.html

oracle redo log 分析

相关专题

更多
php源码安装教程大全
php源码安装教程大全

本专题整合了php源码安装教程,阅读专题下面的文章了解更多详细内容。

65

2025.12.31

php网站源码教程大全
php网站源码教程大全

本专题整合了php网站源码相关教程,阅读专题下面的文章了解更多详细内容。

43

2025.12.31

视频文件格式
视频文件格式

本专题整合了视频文件格式相关内容,阅读专题下面的文章了解更多详细内容。

35

2025.12.31

不受国内限制的浏览器大全
不受国内限制的浏览器大全

想找真正自由、无限制的上网体验?本合集精选2025年最开放、隐私强、访问无阻的浏览器App,涵盖Tor、Brave、Via、X浏览器、Mullvad等高自由度工具。支持自定义搜索引擎、广告拦截、隐身模式及全球网站无障碍访问,部分更具备防追踪、去谷歌化、双内核切换等高级功能。无论日常浏览、隐私保护还是突破地域限制,总有一款适合你!

41

2025.12.31

出现404解决方法大全
出现404解决方法大全

本专题整合了404错误解决方法大全,阅读专题下面的文章了解更多详细内容。

204

2025.12.31

html5怎么播放视频
html5怎么播放视频

想让网页流畅播放视频?本合集详解HTML5视频播放核心方法!涵盖<video>标签基础用法、多格式兼容(MP4/WebM/OGV)、自定义播放控件、响应式适配及常见浏览器兼容问题解决方案。无需插件,纯前端实现高清视频嵌入,助你快速打造现代化网页视频体验。

9

2025.12.31

关闭win10系统自动更新教程大全
关闭win10系统自动更新教程大全

本专题整合了关闭win10系统自动更新教程大全,阅读专题下面的文章了解更多详细内容。

8

2025.12.31

阻止电脑自动安装软件教程
阻止电脑自动安装软件教程

本专题整合了阻止电脑自动安装软件教程,阅读专题下面的文章了解更多详细教程。

3

2025.12.31

html5怎么使用
html5怎么使用

想快速上手HTML5开发?本合集为你整理最实用的HTML5使用指南!涵盖HTML5基础语法、主流框架(如Bootstrap、Vue、React)集成方法,以及无需安装、直接在线编辑运行的平台推荐(如CodePen、JSFiddle)。无论你是新手还是进阶开发者,都能轻松掌握HTML5网页制作、响应式布局与交互功能开发,零配置开启高效前端编程之旅!

2

2025.12.31

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
SQL 教程
SQL 教程

共61课时 | 3.3万人学习

Java 教程
Java 教程

共578课时 | 40.7万人学习

oracle知识库
oracle知识库

共0课时 | 0人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号