Professional Documents
Culture Documents
Internals
Julian Dyke
Independent Consultant
Web Version
1. What is Redo?
2. Redo Records
3. Change Vectors
4. Row Operations
5. Index Operations
6. Other Redo Operations
7. Direct Loads / NOLOGGING
8. Transaction Auditing
9. Supplemental Logging
The redo log buffer is flushed to the redo log file when a
COMMIT is issued
3 © 2005 Julian Dyke juliandyke.com
What is Redo?
Redo log files
Include all changes made by DML statements
INSERT
UPDATE
DELETE
SELECT FOR UPDATE
Do not include DML statement text
Include all changes made to dictionary objects by DDL
statements
Include DDL statement text (9.0.1 and above)
Include all changes made by recursive statements
Data Block
DBWR Data File
Buffer
Arch 1
Group 1
Arch 2
Arch 3
LGWR ARCH
Group 2
Arch 4
Arch 5
Group 3
Arch 6
Redo
Record
Change
#1
Change
#2
Change
#3
..... Change
#N
Header
Fields include
RBA: 0x003666.000000cf.0010
SCN:0x0000.0ac67cc3
Contains
Wrap (2 bytes) e.g 0000
Base (4 bytes) e.g 0ac67cc3
Can apply to
undo headers
undo blocks
data segment headers
data blocks
Consists of
header
array of change record lengths
array of change records
Change Header
Length Vector 16
Change Record 1 20
Change Record 2 48
Change Record 3 28
Change Record 4 29
Change Record 5 2
Change Record 6 2
Change Record 7 10
Fields include
Layers include
xid: 0x0004.00e.0000449b
Contains
Undo segment number (USN) of transaction (0x0004)
Undo segment header transaction table slot (0x00e)
Sequence number (wrap) (0x0000449b)
uba: 0x00c01f17.2758.04
UBA is 7 bytes in length
Contains
DBA of undo block (0x00c01f17)
Sequence number (2758)
Record number in block (4)
REDO #1 11.2
HEADER 5.2
-- Statement #1
INSERT INTO t1
SELECT * FROM t2; UNDO #1 5.1
REDO #1 11.11
REDO #1 11.5
UNDO #2 5.1
REDO #2 11.5
UNDO #3 5.1
REDO #3 11.5
REDO #1 11.3
UNDO #2 5.1
REDO #2 11.3
UNDO #3 5.1
REDO #3 11.3
-- Statement #2
UPDATE t1 UNDO #2 5.1
SET c2 = c2 + 1 REDO #2 11.5
WHERE c1 = 1;
HEADER 5.2
-- T1 contains 3 rows
SELECT c2 FROM t1 UNDO #1 5.1
FOR UPDATE; REDO #1 11.4
UNDO #2 5.1
REDO #2 11.4
UNDO #3 5.1
REDO #3 11.4
UNDO #3 11.3
ROLLBACK;
REDO #3 5.6
UNDO #4 11.3
REDO #4 5.11
COMMIT 5.4
REDO #1 11.2
UNDO #2 5.1
-- Insert into index i1
REDO #2 10.2
UNDO #3 5.1
-- Insert into index i2
REDO #3 10.2
UNDO #3 5.1
-- Insert into index i1
REDO #3 10.2
UNDO #2 5.1
-- Delete from index i1
REDO #2 10.4
UNDO #3 5.1
-- Delete from index i2
REDO #3 10.4
STARTUP MOUNT
ALTER DATABASE FORCE LOGGING;
or
TRANSACTION_AUDITING = FALSE;
Can be specified at
Database level
Table level
Disabled using
ALTER DATABASE DROP SUPPLEMENTAL LOG DATA;
Oracle selects a subset of columns to include in the redo log
Not necessarily unique
Disabled using
ALTER TABLE table1
DROP SUPPLEMENTAL LOG GROUP group1;
See data dictionary views
DBA_LOG_GROUPS
DBA_LOG_GROUP_COLUMNS
Statements Redo
-- Statement #1 HEADER
HEADER 5.25.2
UPDATE t1 UNDO #1 5.1
SET c3 = 400 c3 = 300
WHERE c1 = 100;
c1 = 100
c2 = 200
REDO #1 11.5
c3 = 400
please contact me
My e-mail address is:
info@juliandyke.com
www.juliandyke.com