Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Redo REDO Lib Cache Buffer Cache Locks Network I/O.

Slides:



Advertisements
Similar presentations
Database Tuning. Objectives Describe the roles associated with database tuning. Describe the dependency between tuning in different development phases.
Advertisements

Office of the Accountant General (A&E) Andhra Pradesh Hyderabad
 Databases might get lost  We don’t like that, because …  Solutions are based on logging techniques  General term: write ahead logging.
IO Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Waits Covered in this Section  db file sequential read  db file scattered.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Backup and Recovery Copyright System Managers LLC 2008 all rights reserved.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Oracle High Availability Solutions RAC and Standby Database Copyright System Managers LLC 2008.
Buffer Cache Waits. #.2 Copyright 2006 Kyle Hailey Buffer Cache Waits Waits Disk I/O Buffer Busy Library Cache Enqueue SQL*Net Free Buffer Hot Blocks.
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Oracle Architecture. Instances and Databases (1/2)
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
July 16, 2015ICS 5411 Coping With System Failure Chapter 17 of GUW.
Database Backup and Recovery
Backup and Recovery Part 1.
ITEC474 Redo Log Files.
CHAPTER 5 Managing Control Files, Online Redo Logs, and Archiving.
Oracle Architecture. Database instance When a database is started the current state of the database is given by the data files, a set of background (BG)
Oracle9i Database Administrator: Implementation and Administration
Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Log File Waits  Redo is written to disk when  User commits  Log Buffer.
7 Maintaining Redo Log Files. 7-2 Objectives Explaining the use of online redo log files Obtaining log and archive information Controlling log switches.
Introduction to Oracle Backup and Recovery
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Basic Oracle Architecture
DBMS Transactions and Rollback Recovery Helia / Martti Laiho.
CSE 781 – DATABASE MANAGEMENT SYSTEMS Introduction To Oracle 10g Rajika Tandon.
Part II : Waits Events Kyle Hailey
9 Copyright © 2004, Oracle. All rights reserved. Flashback Database.
Database Systems Slide 1 Database Systems Lecture 5 Overview of Oracle Database Architecture - Concept Manual : Chapters 1,8 Lecturer : Dr Bela Stantic.
7202ICT – Database Administration
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
Copyright  Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
Copyright © Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
CHAPTER 5 Managing Control Files and Online Redo Logs.
© Dennis Shasha, Philippe Bonnet 2001 Log Tuning.
Week 3 Lecture 1 The Redo Log Files and Diagnostic Files.
1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
11 Copyright © 2006, Oracle. All rights reserved. Checkpoint and Redo Tuning.
Instance and Media Recovery Structures Supinfo Oracle Lab. 7.
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
Overview of Oracle Backup and Recovery Darl Kuhn, Regis University.
18 Copyright © 2004, Oracle. All rights reserved. Backup and Recovery Concepts.
Preface 1Performance Tuning Methodology: A Review Course Structure 1-2 Lesson Objective 1-3 Concepts 1-4 Determining the Worst Bottleneck 1-5 Understanding.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.
18 Copyright © 2004, Oracle. All rights reserved. Recovery Concepts.
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
Transactional Recovery and Checkpoints. Difference How is this different from schedule recovery? It is the details to implementing schedule recovery –It.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
SQL*Net & Other Waits. #.2 Copyright 2006 Kyle Hailey SQL*Net Waits Session Shadow Log Buffer Buffer Cache Log Buffer Buffer Cache SGA Library Cache Host.
1-1 Copyright © Oracle Corporation, All rights reserved. Redo Logs and Recovery John Hibbard Senior Principal Instructor Minneapolis MN
6 Copyright © Oracle Corporation, All rights reserved. Backup and Recovery Overview.
What is Oracle ? Oracle is a relational database management system. It is a management system which uses the relational data model. In the relational data.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
Oracle Database Architectural Components
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.
Backup and Recovery.
Transactional Recovery and Checkpoints
Maintaining Online Redo Log Files
Enforcing the Atomic and Durable Properties
Instance and Media Recovery Structures
Kyle Hailey Redo Waits Kyle Hailey
Redo Logs and Recovery John Hibbard Senior Principal Instructor
Oracle9i Database Administrator: Implementation and Administration
Oracle Memory Internals
Oracle Architectural Components
Chapter 5 The Redo Log Files.
Presentation transcript:

Redo Waits Kyle Hailey

#.2 Copyright 2006 Kyle Hailey Redo REDO Lib Cache Buffer Cache Locks Network I/O

#.3 Copyright 2006 Kyle Hailey In This Section: 1.Log Buffer Space 2.Log File Sync 3.Log File Switch Completion 4.Log File Switch (checkpoint incomplete) 5.Log File Switch (private strand flush incomplete) 6.Log File Switch (archiving needed) 7.Switch Log File Command

#.4 Copyright 2006 Kyle Hailey Log File Waits REDO Log Files Data Files DBWR LGWR User2 User1 User3 Log Buffer Buffer Cache Log Buffer Buffer Cache SGA Library Cache

#.5 Copyright 2006 Kyle Hailey Log File Operations  Redo is written to disk when  User commits  Log Buffer 1/3 full (_log_io_size)  Log Buffer fills 1M  Every 3 seconds  DBWR asks LGWR to flush redo  Sessions Commiting wait for LGWR

#.6 Copyright 2006 Kyle Hailey log buffer space  Wait for space in the redo log buffer in SGA  Solution 1. Increase log_buffer parameter in init.ora  Above 3M log_buffer little affect, if still a problem then backup is at disk level 2. Improve disk IO for redo  Faster disk  Raw file  Direct IO  Dedicated disk  p1, p2, p3 – no values

#.7 Copyright 2006 Kyle Hailey Log Buffer Space REDO Log Files Log Buffer LGWR Buffer Cache User2 User1 User3 InsertUpdatedelete Log Buffer Buffer Cache SGA Library Cache 1.Log Buffer too small 2.LGWR too slow Disk problemDisk problem

#.8 Copyright 2006 Kyle Hailey log file sync  Wait for redo flush upon:  Commit  Rollback  Arguments  P1 = buffer# in log buffer that needs to be flushed  P2 = not used  P3 = not used select parameter1, parameter2, parameter3 from v$event_name where name=‘log file sync'; PARAMETER1 PARAMETER2 PARAMETER buffer#

#.9 Copyright 2006 Kyle Hailey Log File Sync REDO Log Files Data Files DBWR LGWR User2 User1 User3 Commit; wait for LGWR Log Buffer Buffer Cache SGA Library Cache

#.10 Copyright 2006 Kyle Hailey Log File Sync: Solutions  Commit less  Often possible in PL/SQL loops that commit every loop  Commit every 50 or 100 instead  Put redo on dedicated disk  Use Raw Device or Direct IO  More Radical  Consider Ram Disks  Can stripe if redo writes are comparable to stripe size  Striping shouldn’t heard  Striping can help  Ex: imp – can have large redo writes – can improve by %  Alternate disks for redo and archiving of redo  Possibly 10gR2  ALTER SYSTEM SET COMMIT_WRITE = BATCH, NOWAIT  Commit could be lost if machine crash  Or IO error

#.11 Copyright 2006 Kyle Hailey Separating LGWR and ARCH Redo 1 Redo 3 Redo 2 Redo 4 LGWR ARCH

#.12 Copyright 2006 Kyle Hailey Log file switch completion  No p1,p2,p3  Wait for lgwr to switch log files when generating redo  Solution:  Increase redo log file size  Reduce frequency of switches

#.13 Copyright 2006 Kyle Hailey Log File Switch completion Log File Switch steps A lot of activity:  Get next log file from control file  Get Redo Copy and Redo Allocation latch  Flush redo  Close File  Update Controlfile  Set new file to Current  Set old file to Active  If in Archivelog mode add file to archive list  Open all members of new logfile group  Write the SCN to the headers  Enable redo log generation DBWR makes a list of blocks that need to be written out in order to over write the Redo log file a list of blocks that need to be written out in order to over write the Redo log file

#.14 Copyright 2006 Kyle Hailey log file switch completion REDO Log Files Data Files Log Buffer DBWR LGWR Buffer Cache Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Wait : log file switch completion User2 User1 User3 User2 User1 User3 Commit; Wait for LGWR Log Buffer Buffer Cache SGA Library Cache Sessions writing redo wait while switch happens

#.15 Copyright 2006 Kyle Hailey log file switch (checkpoint incomplete)  No p1,p2,p3 args  Wait for checkpoint to complete because all log files are full  Solutions  Add more log files  Increase size of log files

#.16 Copyright 2006 Kyle Hailey log file switch (checkpoint incomplete) : Diag REDO Log Files Data Files Log Buffer LGWR Buffer Cache User2 User1 User3 Commit; Wait for LGWR Checkpoint 1 Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Checkpoint 2 Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Checkpoint 3 Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx DBWR Log Buffer Buffer Cache SGA Library Cache Sessions writing redo wait while switch happens And checkpoint happen

#.17 Copyright 2006 Kyle Hailey log file switch (archiving needed)  No p1,p2,p3  Database “hangs” for transactions archive log stop; -- make room in log_archive_dest archive log start;

#.18 Copyright 2006 Kyle Hailey log file switch (archiving needed) : Diag REDO Log Files Archive Dest ARCH LGWR User 2 User 1 User 3 Commit; Wait for LGWR Log Buffer Buffer Cache Log Buffer Buffer Cache Log Buffer Buffer Cache SGA Library Cache 3

#.19 Copyright 2006 Kyle Hailey switch logfile command  Same as log file switch completion but the command is executed by the dba  Alter system switch logfile;

#.20 Copyright 2006 Kyle Hailey Concerns – Recovery Time  What happens to recovery time if I change my redo log file sizes  Larger Redo Log size can increase recovery time but  There are init.ora parameters to limit this  Standby DB: ARCHIVE_LAG_TARGET  Seconds, limits lag between primary and standby  Increases log file switches

#.21 Copyright 2006 Kyle Hailey Incremental Checkpoints (9iR2+)  FAST_START_MTTR_TARGET  Seconds to Recovery  Easy and accuracy  Is overridden by FAST_START_IO_TARGET  Is overridden by LOG_CHECKPOINT_INTERVAL SQL> select ESTIMATED_MTTR from V$INSTANCE_RECOVERY; ESTIMATED_MTTR SQL> select ESTIMATED_MTTR from V$INSTANCE_RECOVERY; ESTIMATED_MTTR alter system set fast_start_mttr_target=17 scope=both;

#.22 Copyright 2006 Kyle Hailey Recovery and Checkpoints REDO Log Files Data Files DBWR LGWR Log Buffer Buffer Cache SGA Library Cache Incremental Checkpoint Current Position Needed for Recovery 1 2 3

#.23 Copyright 2006 Kyle Hailey DBWR dirty List and LGWR Buffers Checkpoint a Block xxxx Block xxxx Block xxxx Block xxxx LGWR DBWR Current Position Incremental Checkpoint DBWR DBWR usually just writes out dirty blocks at end of LRU until checkpoint Now, DBWR keeps a checkpoint list That it cleans a

#.24 Copyright 2006 Kyle Hailey DBWR dirty List MRU - Hot LRU - Cold Buffer Headers Dirty List Block xxxx Block xxxx Block xxxx Block xxxx DBWR DBWR also has to track dirty blocks at the cold end of the LRU

#.25 Copyright 2006 Kyle Hailey DBWR merges Dirty and Checkpoint MRU - Hot LRU - Cold Buffer Headers Dirty List Block xxxx Block xxxx Block xxxx Block xxxx DBWR Checkpoint a Block xxxx Block xxxx Block xxxx Block xxxx Write List Block xxxx Block xxxx Block xxxx Block xxxx Data Files There are 2 checkpoint lists One the DBWR can write to disk While users can disk While users can concurrently update the other

#.26 Copyright 2006 Kyle Hailey log file switch (private strand flush incomplete)  New wait 10g  Like a “log file switch Completion”

#.27 Copyright 2006 Kyle Hailey Redo Wait Solutions 2 log file sync Commit less, put redo logs on faster disks 11 log buffer space Increase log buffer no more than 32M, then tune LGWR 12 log file switch completion Increase log file sizes 22 log file switch (checkpoint incomplete) Add log files (or increase log file size) 30 switch logfile command Avoid switching log files 32 log file switch (archiving needed) *** Archive log running out of space