Oracle Senior DBA Group Linkedin
• Discussion started May 2016
– After a few days – Numerous Likes and Comments
– On Line Redo Logs
– Uncommitted Transactions in Redo Logs
– Log Group Switch Frequency
– Archived Redo Logs with entries still not committed
– Undo Segments
– Oracle Checkpoints
– Transaction Commits
• Response this short Presentation on
– Undo , Redo , Checkpoints , Commits
John Boyle
John.Boyle@Stormtime.co.uk
www.stormtime.co.uk
Over 30 years IT Experience
11 Years in IT Management followed by the last :
15 Years in Training & Consultancy of which :
6 Years working for Oracle University UK
Training Courses have been provided :
• Throughout UK and Ireland
• Europe : Paris, Brussels, Utrecht, Milan, Helsinki
• USA : Tampa FL, Monroe LA, Memphis TN,
Chicago IL, Minneapolis MN, Madison WI
Oracle Leadership Circle San Francisco
Copyright©2016 Stormtime Ltd
Components to Define & Understand
The Undo Tablespace
Is totally different in terms of usage and
structure when compared to
Redo Log Files
Database Checkpoints
ARE NOTHING TO DO WITH
Committing Transactions
UNDO TABLESPACE
• BEFORE images of changed Data Blocks
• USED for
– “Read Consistency”
– Transaction Rollback
– At Process Level (PMON)
– Flashback Query
– Flashback Version Query
– Flashback Transaction Query
– Flashback Transaction
– Flashback Table
Undo Tablespace
Objectives
– Reduce ORA-01555 Errors
– Allow for FLASHBACK if necessary
Decisions
– Size
– UNDO_RETENTION Parameter Value
– RETENTION [ NO ]GUARANTEE
Tools
– V$UNDOSTAT
Online Redo Log Files
• Mandatory for
– Database integrity & Good Performance
– Instance Recovery (SMON)
• Each Online Redo Log File is an
– Online Redo Log Member of an
– Online Redo Log Group
• Minimum Configuration
– 2 Groups each with 1 Member
• Suggested Minimum Configuration ?
– 3 Groups each with 2 Members (i.e. Multiplexed)
Online Redo Log File
Suggested Minimum Configuration ?
v$log.group# & v$logfile.group#
v$logfile.member
nnnnnn nnnnnn + 1 nnnnnn + 2v$log.sequence#
nnnnnn + 3
v$log.status
CURRENT
ACTIVE
INACTIVE
Redo Log File Usage
“Inactive” “Active” -> “Inactive” “Current”
Checkpoint Position ?
Sequence# 229 Sequence# 230 Sequence# 231
Sequence# 232
Redo “Tail”
V$LOG
GROUP# NUMBER
THREAD# NUMBER
SEQUENCE# NUMBER
BYTES NUMBER
BLOCKSIZE NUMBER
MEMBERS NUMBER
ARCHIVED VARCHAR2(3)
STATUS VARCHAR2(16)
FIRST_CHANGE# NUMBER
FIRST_TIME DATE
NEXT_CHANGE# NUMBER
NEXT_TIME DATE
Online Redo Logs
V$LOGFILE
GROUP# NUMBER
STATUS VARCHAR2(7)
TYPE VARCHAR2(7)
MEMBER VARCHAR2(513)
IS_RECOVERY_
DEST_FILE
VARCHAR2(3)
Join on GROUP#
• Database Inconsistent
– e.g. Server Failure, Oracle Shutdown Abort
– Redo marked Open in Controlfile(s)
• Recovery is performed by SMON
– After Database has been Mounted, upon Opening
– No DBA intervention is required (apart from restarting)
– Brings Checkpoint Position to the Redo Tail
– Roll forward Committed Changes
– Rollback Uncommitted Changes
– Only uses Redo Entries (Change Vectors)
Instance Recovery
• Full Database Checkpoint
– SHUTDOWN [ NORMAL | IMMEDIATE | TRANSACTIONAL ]
– ALTER SYSTEM CHECKPOINT ;
– Online Redo Log File switch
– ALTER DATABASE BEGIN BACKUP ;
– (Note : New Storage Snapshot Optimization in 12c R1)
• Partial Database Checkpoint
– ALTER TABLESPACE ts_name OFFLINE [ NORMAL ]
– ALTER TABLESPACE ts_name READ ONLY;
– ALTER TABLESPACE ts_name BEGIN BACKUP ;
• Incremental Database Checkpoint
Database Checkpoints
• Incremental Database Checkpoint Parameters
– LOG_CHECKPOINT_INTERVAL ( OS Blocks )
– LOG_CHECKPOINT_TIMEOUT ( Seconds )
– FAST_START_MTTR_TARGET ( Seconds )
• Also note
– Size of the smallest Online Redo Log File
– LOG_CHECKPOINTS_TO_ALERT [ FALSE | TRUE ]
– SELECT name, value FROM v$sysstat
WHERE name LIKE ‘%checkpoint%’;
Database Checkpoints
Effect of Increase size of Redo Log Files
Redo Log TailCheckpoint Position
Checkpoint Position
Redo Log Tail
RECOVERY
RECOVERY
From
To
Effect of Decrease FAST_START_MMTR_TARGET
Redo Log TailCheckpoint Position
Checkpoint Position
Redo Log Tail
RECOVERY
RECOVERY
From
To
DBA’s Objectives
• Redo Log Files
– Protect against Single Point of Failure
– Two Members in each Group (Multiplexing)
• Checkpoints
– Balance Performance & Instance Recovery Times
– Decide how to Drive Checkpoints
– Redo Logfile Size
– FAST_START_MTTR_TARGET
– Check V$INSTANCE_RECOVERY
– ESTIMATED_MTTR
– TARGET_MTTR
– OPTIMAL_LOGFILE_SIZE
• ENSURE Service Level Agreement Compliance
Transactions - Commit
• A Transaction is a logical unit of work that contains one or
more SQL statements.
• Starts with
– DML
– DDL
• Ends with
– Explicit Commit
– Implicit Commit
– Rollback
– Process Failure
Compare Checkpoint to Commit
• Checkpoint
– Synchronises Memory & Disk
– Can Reduce Recovery Time
– Detrimental to performance if too Frequent
• Commit
– Per Single Transaction
– Guarantees permanency of a Single Transaction
– Write a “Fast Commit Marker” to On Line Redo Log
●
(SCN & Transaction Id)
Short Demonstration
Showing On-line Redo Logs have nothing to do
with Undo Segments
www.stormtime.co.uk www.speak-tech.com
John.Boyle@stormtime.co.uk

Presentation Oracle Undo & Redo Structures

  • 1.
    Oracle Senior DBAGroup Linkedin • Discussion started May 2016 – After a few days – Numerous Likes and Comments – On Line Redo Logs – Uncommitted Transactions in Redo Logs – Log Group Switch Frequency – Archived Redo Logs with entries still not committed – Undo Segments – Oracle Checkpoints – Transaction Commits • Response this short Presentation on – Undo , Redo , Checkpoints , Commits
  • 2.
    John Boyle John.Boyle@Stormtime.co.uk www.stormtime.co.uk Over 30years IT Experience 11 Years in IT Management followed by the last : 15 Years in Training & Consultancy of which : 6 Years working for Oracle University UK Training Courses have been provided : • Throughout UK and Ireland • Europe : Paris, Brussels, Utrecht, Milan, Helsinki • USA : Tampa FL, Monroe LA, Memphis TN, Chicago IL, Minneapolis MN, Madison WI Oracle Leadership Circle San Francisco Copyright©2016 Stormtime Ltd
  • 3.
    Components to Define& Understand The Undo Tablespace Is totally different in terms of usage and structure when compared to Redo Log Files Database Checkpoints ARE NOTHING TO DO WITH Committing Transactions
  • 4.
    UNDO TABLESPACE • BEFOREimages of changed Data Blocks • USED for – “Read Consistency” – Transaction Rollback – At Process Level (PMON) – Flashback Query – Flashback Version Query – Flashback Transaction Query – Flashback Transaction – Flashback Table
  • 5.
    Undo Tablespace Objectives – ReduceORA-01555 Errors – Allow for FLASHBACK if necessary Decisions – Size – UNDO_RETENTION Parameter Value – RETENTION [ NO ]GUARANTEE Tools – V$UNDOSTAT
  • 6.
    Online Redo LogFiles • Mandatory for – Database integrity & Good Performance – Instance Recovery (SMON) • Each Online Redo Log File is an – Online Redo Log Member of an – Online Redo Log Group • Minimum Configuration – 2 Groups each with 1 Member • Suggested Minimum Configuration ? – 3 Groups each with 2 Members (i.e. Multiplexed)
  • 7.
    Online Redo LogFile Suggested Minimum Configuration ? v$log.group# & v$logfile.group# v$logfile.member nnnnnn nnnnnn + 1 nnnnnn + 2v$log.sequence# nnnnnn + 3 v$log.status CURRENT ACTIVE INACTIVE
  • 8.
    Redo Log FileUsage “Inactive” “Active” -> “Inactive” “Current” Checkpoint Position ? Sequence# 229 Sequence# 230 Sequence# 231 Sequence# 232 Redo “Tail”
  • 9.
    V$LOG GROUP# NUMBER THREAD# NUMBER SEQUENCE#NUMBER BYTES NUMBER BLOCKSIZE NUMBER MEMBERS NUMBER ARCHIVED VARCHAR2(3) STATUS VARCHAR2(16) FIRST_CHANGE# NUMBER FIRST_TIME DATE NEXT_CHANGE# NUMBER NEXT_TIME DATE Online Redo Logs V$LOGFILE GROUP# NUMBER STATUS VARCHAR2(7) TYPE VARCHAR2(7) MEMBER VARCHAR2(513) IS_RECOVERY_ DEST_FILE VARCHAR2(3) Join on GROUP#
  • 10.
    • Database Inconsistent –e.g. Server Failure, Oracle Shutdown Abort – Redo marked Open in Controlfile(s) • Recovery is performed by SMON – After Database has been Mounted, upon Opening – No DBA intervention is required (apart from restarting) – Brings Checkpoint Position to the Redo Tail – Roll forward Committed Changes – Rollback Uncommitted Changes – Only uses Redo Entries (Change Vectors) Instance Recovery
  • 11.
    • Full DatabaseCheckpoint – SHUTDOWN [ NORMAL | IMMEDIATE | TRANSACTIONAL ] – ALTER SYSTEM CHECKPOINT ; – Online Redo Log File switch – ALTER DATABASE BEGIN BACKUP ; – (Note : New Storage Snapshot Optimization in 12c R1) • Partial Database Checkpoint – ALTER TABLESPACE ts_name OFFLINE [ NORMAL ] – ALTER TABLESPACE ts_name READ ONLY; – ALTER TABLESPACE ts_name BEGIN BACKUP ; • Incremental Database Checkpoint Database Checkpoints
  • 12.
    • Incremental DatabaseCheckpoint Parameters – LOG_CHECKPOINT_INTERVAL ( OS Blocks ) – LOG_CHECKPOINT_TIMEOUT ( Seconds ) – FAST_START_MTTR_TARGET ( Seconds ) • Also note – Size of the smallest Online Redo Log File – LOG_CHECKPOINTS_TO_ALERT [ FALSE | TRUE ] – SELECT name, value FROM v$sysstat WHERE name LIKE ‘%checkpoint%’; Database Checkpoints
  • 13.
    Effect of Increasesize of Redo Log Files Redo Log TailCheckpoint Position Checkpoint Position Redo Log Tail RECOVERY RECOVERY From To
  • 14.
    Effect of DecreaseFAST_START_MMTR_TARGET Redo Log TailCheckpoint Position Checkpoint Position Redo Log Tail RECOVERY RECOVERY From To
  • 15.
    DBA’s Objectives • RedoLog Files – Protect against Single Point of Failure – Two Members in each Group (Multiplexing) • Checkpoints – Balance Performance & Instance Recovery Times – Decide how to Drive Checkpoints – Redo Logfile Size – FAST_START_MTTR_TARGET – Check V$INSTANCE_RECOVERY – ESTIMATED_MTTR – TARGET_MTTR – OPTIMAL_LOGFILE_SIZE • ENSURE Service Level Agreement Compliance
  • 16.
    Transactions - Commit •A Transaction is a logical unit of work that contains one or more SQL statements. • Starts with – DML – DDL • Ends with – Explicit Commit – Implicit Commit – Rollback – Process Failure
  • 17.
    Compare Checkpoint toCommit • Checkpoint – Synchronises Memory & Disk – Can Reduce Recovery Time – Detrimental to performance if too Frequent • Commit – Per Single Transaction – Guarantees permanency of a Single Transaction – Write a “Fast Commit Marker” to On Line Redo Log ● (SCN & Transaction Id)
  • 18.
    Short Demonstration Showing On-lineRedo Logs have nothing to do with Undo Segments www.stormtime.co.uk www.speak-tech.com John.Boyle@stormtime.co.uk

Editor's Notes

  • #2 <number>
  • #3 <number>
  • #7 <number>
  • #9 <number>
  • #12 <number>
  • #13 <number>