Maison > Article > base de données > oracle redo log 分析
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
Environment:
OS: Ubuntu 10.10
Oracle: 11.1.0.6.0
Test table: test_user
Current data:
Operation:
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:
Reo Record Header
value: 1
value: 0x00007.00012d3d.0010
sequence_number: 0x00007
block_number: 0x00012d3d
offset: 0x10
value: 0x22c
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.
|
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"
value: 0x0000.000fddbd
value: 1
value: 12/21/2010 16:30:29
Change #1:
Change Header:
value: 2
|
value: 1 - mean data block
get file info using this sql statement:
value: 4 - means to "users01.dbf"
value: 0x01000195
File No: 4
Block No: 0x195
value: 71329
value: 0x0000.000fdd5e
wrap: 0x0000
base: 0xfdd5e
value: 2
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:
|
For "Table Operation(DML)", description as follows:
|
For "Transaction Layer (Undo)", description as follows:
|
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:
|
xid: Transaction ID. Format is usn#.slot#.wrap# Components are:
|
value: 0x000a.005.0000035a
usn: 0x000a
slot: 0x005
wrap: 0x0000035a
|
value: 0x00c00478.01ca.28
dba: 0x00c00478
seq: 0x01ca
rec: 0x28
Update of column 1 (name) to 'ddd'
Change #2:
Change header:
Change body:
Change #3:
Change header:
Change #4:
Change header:
Change Body:
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