11 Copyright © 2006, Oracle. All rights reserved. Checkpoint and Redo Tuning.

Slides:



Advertisements
Similar presentations
Office of the Accountant General (A&E) Andhra Pradesh Hyderabad
Advertisements

9 Copyright © 2006, Oracle. All rights reserved. Tuning the Buffer Cache.
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Overview of Database Administrator (DBA) Tools
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 2 Overview of Database Administrator (DBA) Tools.
Oracle Architecture. Instances and Databases (1/2)
Page Footer Keed Education Oracle Database Administration Basic Copyright 2009 Keed Education BV Version Concept.
15 Copyright © 2004, Oracle. All rights reserved. Monitoring and Managing Memory.
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
Oracle Architectural Components
10 Copyright © 2006, Oracle. All rights reserved. Automatic Shared Memory Management.
ITEC474 Redo Log Files.
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.
Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Redo REDO Lib Cache Buffer Cache Locks Network I/O.
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
1 Copyright © 2009, Oracle. All rights reserved. Exploring the Oracle Database Architecture.
Oracle Database Workshop 1 Presented to IBRI CAS 27-Nov-2011 By Abdullah Alkalbani.
Oracle Documentation Oracle DBA Course (9i, 10g, 11g) Lecture 1: Oracle Architectural Components.
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
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
CSE 781 – DATABASE MANAGEMENT SYSTEMS Introduction To Oracle 10g Rajika Tandon.
4 Copyright © 2006, Oracle. All rights reserved. Recovering from Noncritical Losses.
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.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
Backup and Recovery Overview Supinfo Oracle Lab. 6.
15 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Summary.
7 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
8 Copyright © Oracle Corporation, All rights reserved. Configuring the Database Archiving Mode.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
Instance and Media Recovery Structures Supinfo Oracle Lab. 7.
Configuring the Database Archiving Mode
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
12 Copyright © Oracle Corporation, All rights reserved. User-Managed Complete Recovery.
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.
2 Copyright © 2007, Oracle. All rights reserved. Configuring for Recoverability.
Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.
3 Copyright © 2004, Oracle. All rights reserved. Creating an Oracle Database.
18 Copyright © 2004, Oracle. All rights reserved. Recovery Concepts.
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
6 Copyright © Oracle Corporation, All rights reserved. Backup and Recovery Overview.
3 Copyright © 2004, Oracle. All rights reserved. Database Architecture Comparison.
1 Copyright © 2006, Oracle. All rights reserved. Introduction.
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.
6 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
Copyright  Oracle Corporation, All rights reserved. 3 Oracle Backup and Recovery Configuration.
5 Copyright © 2005, Oracle. All rights reserved. Managing the Oracle Instance.
Oracle Database Architectural Components
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.
Maintaining Online Redo Log Files
Instance and Media Recovery Structures
Kyle Hailey Redo Waits Kyle Hailey
Oracle Architectural Components
Oracle9i Database Administrator: Implementation and Administration
Introduction To Oracle 10g
Index Index.
Chapter 5 The Redo Log Files.
Presentation transcript:

11 Copyright © 2006, Oracle. All rights reserved. Checkpoint and Redo Tuning

11-2 Copyright © 2006, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Diagnose checkpoint and redo issues Implement Fast Start MTTR Target Monitor the performance impact of Fast Start MTTR Target Tune the redo chain Size the redo log file Size the redo log buffer

11-3 Copyright © 2006, Oracle. All rights reserved. Checkpoint and Redo Checkpoint: –Transfers changed data to disk –Makes buffer space available for more data blocks –Controls mean time to recover (MTTR) Redo: –Recovers committed data not on disk –Provides uncommitted data for rollback operation –Provides source data for complete recovery

11-4 Copyright © 2006, Oracle. All rights reserved. Spfile Temp Data file Undo Oracle Database Architecture PMON SMON RECO MMON MMNL PSP0 MMANDBWnLGWR CKPT CJQ0 S000 D000 QMNC Qnnn FMON ARCn CTWR RVWR Fixed size Large pool Java pool Streams pool Default buffer cache Keep buffer cache Recycle buffer cache nK buffer caches Redo log buffer ASH buffer Sort extent pool Global context pool SGA Flash back buffer Instance Flashback logs Redo log files Archive log files Control files SYSTEM SYSAUX Change tracking file Password file Shared pool

11-5 Copyright © 2006, Oracle. All rights reserved. Checkpoint Architecture The checkpoint architecture provides: Checkpoint position: A starting position in the redo logs to begin recovery Checkpoint target: A calculated position in the redo logs where the checkpoint position should be An estimated mean time to recover A high-performance incremental checkpoint A full checkpoint when required

11-6 Copyright © 2006, Oracle. All rights reserved. Database Writer (DBWn) Process DBWn writes when one of the following events occurs: Checkpoint Dirty buffers’ threshold No free buffers Timeout RAC ping request Tablespace OFFLINE Tablespace READ ONLY Table DROP or TRUNCATE Tablespace BEGIN BACKUP SGA Database buffer cache Data files Database Writer (DBWn) Background Information

11-7 Copyright © 2006, Oracle. All rights reserved. Checkpoint (CKPT) Process Responsible for: Signaling DBWn at checkpoints Updating data file headers with checkpoint information Updating control files with checkpoint information Database Writer (DBWn) Checkpoint (CKPT) SGA Database buffer cache

11-8 Copyright © 2006, Oracle. All rights reserved. Redo Architecture Redo is designed for minimum performance impact. Server processes write to the redo log buffer: –Circular buffer –Memory-to-memory writes –Small fast writes LGWR writes log buffer blocks to log files: –Circular files –Memory-to-disk write –Full blocks if possible ARCn copies log files to archive log files: –Disk-to-disk writes –Multiple archiver processes can be started.

11-9 Copyright © 2006, Oracle. All rights reserved. Database buffer cache Redo log buffer Shared pool Library cache Data dictionary cache User global area The Redo Log Buffer SQL> UPDATE employees 2 SET salary=salary*1.1 3 WHERE employee_id=736; Server process LGWR Control files ARCn Archived log files Redo log files Data files

11-10 Copyright © 2006, Oracle. All rights reserved. Redo Log Files and LogWriter Redo log files: Record changes to the database Should be multiplexed to protect against loss LogWriter writes: At commit When one-third full Every three seconds Before DBWn writes Group 3 Log Writer (LGWR) Group 1Group 2 Redo log buffer SGA Redo log files

11-11 Copyright © 2006, Oracle. All rights reserved. Archiver (ARCn) Is an optional background process Automatically archives online redo log files when ARCHIVELOG mode is set for the database Preserves the record of all changes made to the database LogWriter (LGWR) Archiver (ARCn) Redo log buffer SGA

11-12 Copyright © 2006, Oracle. All rights reserved. Incremental Checkpointing c1 Checkpoint position c2 c3 c4 c5 Tail of redo thread Redo stream Checkpoint queue Target RBA b3 b4 t2 t1 FAST_START_MTTR_TARGET=T t1 + t2 < T b1 b2 Incremental checkpoint

11-13 Copyright © 2006, Oracle. All rights reserved. Notes only slide

11-14 Copyright © 2006, Oracle. All rights reserved. Incremental Checkpoint and Log File Size The maximum checkpoint lag is: 90%*(SUM(log_size i ) – MAX(log_size i )) Checkpoint lag is designed to prevent log switch from blocking. A few small log files can result in excess checkpoint writes. Current tail Target checkpoint 9,000 blocks Log file#1: 10,000 blocks Log file#2: 10,000 blocks

11-15 Copyright © 2006, Oracle. All rights reserved. Adjusting the Checkpoint Rate The checkpoint rate is determined by the most aggressive of: FAST_START_MTTR_TARGET parameter (only on Enterprise Edition) Size of the smallest redo log file LOG_CHECKPOINT_TIMEOUT parameter (overrides FAST_START_MTTR_TARGET if set) LOG_CHECKPOINT_INTERVAL parameter (overrides FAST_START_MTTR_TARGET if set)

11-16 Copyright © 2006, Oracle. All rights reserved. Redo Logfile Size Advisor This advisor determines the optimal size of your online redo logs: –No additional checkpoint writes beyond those caused by FAST_START_MTTR_TARGET. FAST_START_MTTR_TARGET must be set. This column shows the redo log file size (in megabytes) that is considered as minimal. Description OPTIMAL_LOGFILE_SIZE Column name V$INSTANCE_RECOVERY View name

11-17 Copyright © 2006, Oracle. All rights reserved. Impact of the Checkpoint Rate SELECT c.value-nc.value FROM V$SYSSTAT c, V$SYSSTAT nc WHERE c.name = 'physical writes' AND nc.name = 'physical writes non checkpoint'; Statistic Total physical writes 47,308 physical writes non checkpoint 44,674 From the V$ views: From the Statspack report:

11-18 Copyright © 2006, Oracle. All rights reserved. Notes only slide

11-19 Copyright © 2006, Oracle. All rights reserved. Automatic Checkpoint Tuning There is no longer a continuous manual tuning effort. Automatic checkpoint tuning is the best-effort checkpointing, without much overhead. It reduces average recovery time by making use of unused bandwidth. Automatic checkpoint tuning is enabled when FAST_START_MTTR_TARGET is not explicitly set to zero.

11-20 Copyright © 2006, Oracle. All rights reserved. ADDM Report: Checkpoints

11-21 Copyright © 2006, Oracle. All rights reserved. ADDM Report: Redo Logs

11-22 Copyright © 2006, Oracle. All rights reserved. Statspack and AWR Reports Top 5 Timed Events Avg %Total ~~~~~~~~~~~~~~~~~~ wait Call Event Waits Time (s) (ms) Time CPU time log file parallel write 3, log file sync latch: redo copy latch: redo allocation 1, Checkpoint and redo show certain symptoms: Alert log shows log switch not complete I/O symptoms caused by excessive checkpoints Log switches per hour > 4 log file and latch:redo in Top Timed Events

11-23 Copyright © 2006, Oracle. All rights reserved. Notes only slide

11-24 Copyright © 2006, Oracle. All rights reserved. Check Parameters Parameter Name Begin value fast_start_mttr_target 25 Review checkpoint parameters for reasonable values: SQL> SELECT mttr_target_for_estimate, 2> estd_total_ios, estd_total_io_factor 3> FROM V$MTTR_TARGET_ADVICE ORDER BY 1 MTTR_TARGET_FOR_ESTIMATE ESTD_TOTAL_IOS ESTD_TOTAL_IO_FACTOR Use V$MTTR_TARGET_ADVICE for optimum value:

11-25 Copyright © 2006, Oracle. All rights reserved. Check the Redo Log Size Review the current size of the redo log files: Check alert log for log switch rate:

11-26 Copyright © 2006, Oracle. All rights reserved. Redo Log Chain Tuning Redo tuning starts with the slowest part. Reduce the amount of redo generated. Check archive logging (waits for archiving needed). Check the redo log file size and log switch rate. Check the checkpoint parameters. Look for log space requests. The Redo Buffer Allocation Retries value should be near 0 and should be less than 1% of redo entries.

11-27 Copyright © 2006, Oracle. All rights reserved.

11-28 Copyright © 2006, Oracle. All rights reserved. Reducing Redo Operations Ways to avoid logging bulk operations in the redo log: Direct Path loading without archiving does not generate redo. Direct Path loading with archiving can use NOLOGGING mode. Direct Load INSERT can use NOLOGGING mode. Some SQL statements can use NOLOGGING mode.

11-29 Copyright © 2006, Oracle. All rights reserved.

11-30 Copyright © 2006, Oracle. All rights reserved. Increasing the Performance of Archiving Share the archiving work during a temporary increase in workload: Increase the number of archiver processes with LOG_ARCHIVE_MAX_PROCESSES. Multiplex the redo log files, and add more members. Change the number of archive destinations: – LOG_ARCHIVE_DEST_n ALTER SYSTEM ARCHIVE LOG ALL TO

11-31 Copyright © 2006, Oracle. All rights reserved.

11-32 Copyright © 2006, Oracle. All rights reserved. Diagnostic Tools V$ARCHIVE_DEST V$ARCHIVED_LOG V$ARCHIVE_PROCESSES LOG_ARCHIVE_DEST_n Archived logs LOG_ARCHIVE_DEST_STATE_n

11-33 Copyright © 2006, Oracle. All rights reserved. LGWR Redo Log Groups and Members Group 2Group 3Group 1 Disk 1 Disk 2 Member

11-34 Copyright © 2006, Oracle. All rights reserved. Online Redo Log File Configuration Size redo log files to minimize contention. Provide enough groups to prevent waiting. Store redo log files on separate, fast devices. Monitor the redo log file configuration with: – V$LOGFILE – V$LOG – V$LOG_HISTORY

11-35 Copyright © 2006, Oracle. All rights reserved. Monitoring Online Redo Log File I/O

11-36 Copyright © 2006, Oracle. All rights reserved. Sizing the Redo Log Buffer The size of the redo log buffer is determined by: LOG_BUFFER parameter Remaining space in the fixed area granule Default value: Either 2 MB or 128 KB  the value of CPU_COUNT, whichever is greater

11-37 Copyright © 2006, Oracle. All rights reserved. Archived log files Redo log files Diagnosing Redo Log Buffer Inefficiency SQL> UPDATE employees 2 SET salary=salary*1.1 3 WHERE employee_id=736; Server process LGRW ARCH Server process SQL> DELETE FROM employees 2 WHERE employee_id=7400;

11-38 Copyright © 2006, Oracle. All rights reserved. Diagnosing Log Buffer Problems V$SESSION_WAIT Log Buffer Space event V$SYSSTAT Redo Buffer Allocation Retries Redo Entries Redo log buffer

11-39 Copyright © 2006, Oracle. All rights reserved.

11-40 Copyright © 2006, Oracle. All rights reserved. Log Space Request Waits: Further Investigation Possible reasons for log space request waits: There is disk I/O contention on redo log files. LGWR is waiting on DBWn to complete the checkpointing of the required redo log file. LGWR is waiting on ARCn to complete archiving of the required redo log file. Log buffer is too small.

11-41 Copyright © 2006, Oracle. All rights reserved.

11-42 Copyright © 2006, Oracle. All rights reserved. Practice Overview: Diagnose Checkpoints and Redo This practice covers the following topics: Diagnose checkpoint and redo issues Resize log files Adjust the checkpoint parameters

11-43 Copyright © 2006, Oracle. All rights reserved. Summary In this lesson, you should have learned how to: Diagnose checkpoint and redo issues Implement Fast Start MTTR Target Monitor the performance impact of Fast Start MTTR Target Implement multiple database writers Tune the redo chain Size the redo log file Size the redo log buffer

11-44 Copyright © 2006, Oracle. All rights reserved.