DBMS Transactions and
Rollback Recovery
Helia / Martti Laiho
Control Buffers
Data Buffer (Buffer pool)
Log Buffer
Transaction Log files
- Connections- Transaction queueing- Locking List- etc
before image / after image
Table pagesand index pages x
Database Instance
Checkpoint:
Commit/Rollback:
Application programs - Sessions (connections) - Transactions - SQL commands
Helia / Martti Laiho, 1998-2003
DBMSListener / ServerTransaction ManagerSQL Engine (parser)Security ManagerQuery OptimizerConcurrency Manager (Lock Manager)Recovery ManagerRelational EngineMemory Manager
DBMSListener / ServerTransaction ManagerSQL Engine (parser)Security ManagerQuery OptimizerConcurrency Manager (Lock Manager)Recovery ManagerRelational EngineMemory Manager
LRU
x
Data file
Data fileFile ManagerFile Manager
Disk ManagerDisk Manager
read
write
write
Processing a Transaction
Insert into table
Update table
Delete from table
Select ..
Commit / Rollback
undo /redo data
undo / redo data
undo / redo data
commit / rollback
LGWR
OK ?
continue
User process: Data buffer Redo log buffer
Redo log files
(Rollback Segments -
Oracle only)
undo
undo data
undo data
?
On Rollback
before imagesafter images
Marking Checkpoint into Transaction Log
time
T1
T2
T3
T4
T5
Write Checkpointrecord into the log
of the current transactions
tc
Helia / Martti Laiho, 1998-2005
Commit
Rollback
Commit
Begin
Begin
Begin
Begin
Begin
Write all after imagesInto the database
A Soft Crash
time
T1
T2
T3
T4
T5
Checkpointrecord
SystemFailure
tctf
“Soft Crash”
Helia / Martti Laiho, 1998-2005
Commit
Rollback
Commit
Rollback recovery using transaction log
time
T1
T2
T3
T4
T5
Checkpointrecord
tctf
Rollback Recovery:
Undo list: T1, T2, T3 , T4, T5
Redo list: -
Helia / Martti Laiho, 1998-2005
Commit
Rollback
Commit
2. Find the last checkpoint record
3. Add transactions on undo list
1. Start up
From checkpointrecord
From the log after the checkpoint
Rollback recovery using transaction log
time
T1
T2
T3
T4
T5
Checkpointrecord
tctf
Rollback Recovery
Undo list: T1, T2, T3, T4, T5
Redo list: T1, T4
Helia / Martti Laiho, 1998-2005
Commit
Rollback
Commit
34. Move committed transactions to Redo list
Rollback recovery using transaction log
time
T1
T2
T3
T4
T5
Checkpointrecord
tc tf
Helia / Martti Laiho, 1998-2005
Commit
Rollback
Commit
Rollback Recovery
Undo list: T1, T2, T3, T4, T5
Redo list: T1, T4
5 5. Rollback transactions of the Undo list - writing the before images into the database Redo transactions of the Redo list - writing the after images into the database
6. Open the DBMS service to applications
undo
redo
redo
undo
undo
Top Related