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

<textarea>SQL> select object_id from user_objects where object_name='TEST_USER';

 OBJECT_ID
----------
     71329
</textarea>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 分析

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
Golang 生态工具与框架:扩展开发能力
Golang 生态工具与框架:扩展开发能力

《Golang 生态工具与框架》系统梳理 Go 语言在实际工程中的主流工具链与框架选型思路,涵盖 Web 框架、RPC 通信、依赖管理、测试工具、代码生成与项目结构设计等内容。通过真实项目场景解析不同工具的适用边界与组合方式,帮助开发者构建高效、可维护的 Go 工程体系,并提升团队协作与交付效率。

1

2026.02.24

Golang 性能优化专题:提升应用效率
Golang 性能优化专题:提升应用效率

《Golang 性能优化专题》聚焦 Go 应用在高并发与大规模服务中的性能问题,从 profiling、内存分配、Goroutine 调度、GC 机制到 I/O 与锁竞争逐层分析。结合真实案例讲解定位瓶颈的方法与优化策略,帮助开发者建立系统化性能调优思维,在保证代码可维护性的同时显著提升服务吞吐与稳定性。

2

2026.02.24

Golang 面试题精选:高频问题与解答
Golang 面试题精选:高频问题与解答

Golang 面试题精选》系统整理企业常见 Go 技术面试问题,覆盖语言基础、并发模型、内存与调度机制、网络编程、工程实践与性能优化等核心知识点。每道题不仅给出答案,还拆解背后的设计原理与考察思路,帮助读者建立完整知识结构,在面试与实际开发中都能更从容应对复杂问题。

1

2026.02.24

Golang 运行与部署实战:从本地到云端
Golang 运行与部署实战:从本地到云端

《Golang 运行与部署实战》围绕 Go 应用从开发完成到稳定上线的完整流程展开,系统讲解编译构建、环境配置、日志与配置管理、容器化部署以及常见运维问题处理。结合真实项目场景,拆解自动化构建与持续部署思路,帮助开发者建立可靠的发布流程,提升服务稳定性与可维护性。

3

2026.02.24

Golang 疑难杂症解决指南:常见问题排查与优化
Golang 疑难杂症解决指南:常见问题排查与优化

《Golang 疑难杂症解决指南》聚焦开发过程中常见却棘手的问题,从并发模型、内存管理、性能瓶颈到工程化实践逐步拆解。通过真实案例与调试思路,帮助开发者定位问题根因,建立系统化排查方法。不只给出答案,更强调分析路径与工具使用,让你在复杂 Go 项目中具备持续解决问题的能力。

1

2026.02.24

Golang 入门学习路线:从零基础到上手开发
Golang 入门学习路线:从零基础到上手开发

Golang 入门路线涵盖从零到上手的核心路径:首先打牢基础语法与切片等底层机制;随后攻克 Go 的灵魂——接口设计与 Goroutine 并发模型;接着通过 Gin 框架与 GORM 深入 Web 开发实战;最后在微服务与云原生工具开发中进阶,旨在培养具备高性能并发处理能力的后端工程师。

0

2026.02.24

中国研究生招生信息网官方网站入口 研招网网页版在线入口
中国研究生招生信息网官方网站入口 研招网网页版在线入口

中国研究生招生信息网入口(https://yz.chsi.com.cn) 此网站是研究生报名入口的唯一官方网站

95

2026.02.24

苹果官网入口与在线访问指南_中国站点快速直达与iPhone查看方法
苹果官网入口与在线访问指南_中国站点快速直达与iPhone查看方法

本专题汇总苹果官网最新可用入口及中国站点访问方式,涵盖官网直达链接、iPhone官方页面查看方法与常见访问说明,帮助用户快速进入苹果官方网站,便捷了解产品信息与官方服务。

14

2026.02.24

Asianfanfics官网入口与访问指南_AFF官方平台最新登录地址
Asianfanfics官网入口与访问指南_AFF官方平台最新登录地址

本专题系统整理Asianfanfics(AFF)官方网站最新可用入口,涵盖官方平台最新直达地址、官网登录方式及中文访问指引,帮助用户快速、安全地进入AFF平台浏览与使用相关内容。

15

2026.02.24

热门下载

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

精品课程

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

共61课时 | 4万人学习

Java 教程
Java 教程

共578课时 | 71.8万人学习

oracle知识库
oracle知识库

共0课时 | 0.6万人学习

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

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