Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "11 Copyright © 2006, Oracle. All rights reserved. Checkpoint and Redo Tuning."— Presentation transcript:

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

2 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

3 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

4 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

5 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

6 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

7 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

8 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.

9 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

10 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-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

12 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

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

14 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

15 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)

16 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

17 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:

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

19 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.

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

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

22 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 551 56.8 log file parallel write 3,899 201 52 20.7 log file sync 823 58 71 6.0 latch: redo copy 635 44 70 4.6 latch: redo allocation 1,109 42 38 4.4 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

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

24 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 ------------------------ -------------- -------------------- 20 2436690 1.0739 22 2330674 1.0272 25 2268973 1 37 2204817.9717 62 2181841.9616 Use V$MTTR_TARGET_ADVICE for optimum value:

25 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:

26 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.

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

28 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.

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

30 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

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

32 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

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

34 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

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

36 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

37 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;

38 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

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

40 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.

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

42 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

43 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

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


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

Similar presentations


Ads by Google