3 Copyright © 2006, Oracle. All rights reserved. Statistics and Wait Events.

Slides:



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

9 Copyright © 2006, Oracle. All rights reserved. Automatic Performance Management.
13 Copyright © 2005, Oracle. All rights reserved. Monitoring and Improving Performance.
Overview of performance tuning strategies Oracle Performance Tuning Allan Young June 2008.
1 Wait Event Enhancements in Oracle 10g Terry Sutton and Roger Schrag Database Specialists, Inc.
Enqueue Waits : Locks. #.2 Copyright 2006 Kyle Hailey Locks REDO Lib Cache Buffer Cache IO Locks Network.
4 Copyright © 2005, Oracle. All rights reserved. Managing the Oracle Instance.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Oracle High Availability Solutions RAC and Standby Database Copyright System Managers LLC 2008.
1 Chapter 16 Latch and Mutex Contention. 2 Architecture Overview of Latches Protect Oracle’s SGA Prevent two processes from updating same area of SGA.
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.
1 Interpreting Wait Events To Boost System Performance Roger Schrag Database Specialists, Inc.
13 Copyright © 2005, Oracle. All rights reserved. Performance Management.
13 Copyright © 2007, Oracle. All rights reserved. Performance Management.
15 Copyright © 2004, Oracle. All rights reserved. Monitoring and Managing Memory.
The Self-managing Database: Automatic Performance Diagnosis Graham Wood Kyle Hailey Oracle Corporation Session id:
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
Waits Defined Kyle Hailey #.2 Copyright 2006 Kyle Hailey Top 36 Foreground Waits write complete waits library cache.
1 Copyright © 2009, Oracle. All rights reserved. Exploring the Oracle Database Architecture.
Module 15: Monitoring. Overview Formulate requirements and identify resources to monitor in a database environment Types of monitoring that can be carried.
Module 8: Server Management. Overview Server-level and instance-level resources such as memory and processes Database-level resources such as logical.
12 Copyright © 2004, Oracle. All rights reserved. Automatic Management.
12 Copyright © 2007, Oracle. All rights reserved. Database Maintenance.
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
#.1 Oracle Wait Interface in Oracle 10g. #.2 Today’s Session  Twelve wait event interface enhancements in Oracle 10g that we really like.  Documentation.
14 Copyright © 2004, Oracle. All rights reserved. Performance Monitoring.
Part II : Waits Events Kyle Hailey
Database Systems Slide 1 Database Systems Lecture 5 Overview of Oracle Database Architecture - Concept Manual : Chapters 1,8 Lecturer : Dr Bela Stantic.
Oracle Tuning Considerations. Agenda Why Tune ? Why Tune ? Ways to Improve Performance Ways to Improve Performance Hardware Hardware Software Software.
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.
Oracle Tuning Ashok Kapur Hawkeye Technology, Inc.
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.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
15 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Summary.
Outline Introduction to Oracle Memory Structures SGA, PGA, SCA The Specifics of the System Global Area (SGA) Structures Overview of Program Global Areas.
Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey
4 Copyright © 2007, Oracle. All rights reserved. Managing the Oracle Instance.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
#.6 Sampling Kyle Hailey
10G - New Manageability Features Presented by Lenka Vanek
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
Preface 1Performance Tuning Methodology: A Review Course Structure 1-2 Lesson Objective 1-3 Concepts 1-4 Determining the Worst Bottleneck 1-5 Understanding.
#.1 Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
5 Copyright © Oracle Corporation, All rights reserved. Usage and Configuration of the Oracle Shared Server.
Oracle9i Performance Tuning Chapter 4 Tuning the Shared Pool Memory.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
8 Copyright © 2006, Oracle. All rights reserved. Tuning the Shared Pool.
6 Copyright © Oracle Corporation, All rights reserved. Backup and Recovery Overview.
9 Copyright © 2004, Oracle. All rights reserved. Incomplete Recovery.
4 Copyright © 2004, Oracle. All rights reserved. Managing the Oracle Instance.
5 Copyright © 2005, Oracle. All rights reserved. Managing the Oracle Instance.
Oracle Database Architectural Components
1 Copyright © 2005, Oracle. All rights reserved. Oracle Database Administration: Overview.
1 PVSS Oracle scalability Target = changes per second (tested with 160k) changes per client 5 nodes RAC NAS 3040, each with one.
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.
3 Copyright © Oracle Corporation, All rights reserved. 管理数据库事例.
SQL Trace and TKPROF.
Interpreting Wait Events To Boost System Performance
Performance Management
Performance Management
Oracle Architectural Components
Wait Event Enhancements in Oracle 10g
Presentation transcript:

3 Copyright © 2006, Oracle. All rights reserved. Statistics and Wait Events

3-2 Copyright © 2006, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Identify dynamic performance views useful in tuning Identify the key tuning components of the alert log file Identify the key tuning components of user trace files Use dynamic performance views to view statistics and wait events

3-3 Copyright © 2006, Oracle. All rights reserved. Performance Tuning Data Type of data gathered: Cumulative statistics: –Wait events with time information –Time model Metrics: Statistic rates Sampled statistics: Active session history –Statistics by session –Statistics by SQL –Statistics by service –Other dimensions

3-4 Copyright © 2006, Oracle. All rights reserved. Performance Tuning Tools Tools that are available: Basic: –Enterprise Manager pages –Alert log –Trace files –Dynamic performance views and tables Add-in: –Statspack Options: –Diagnostics pack –Tuning pack

3-5 Copyright © 2006, Oracle. All rights reserved. Accessing the Database Home Page name:1158/em

3-6 Copyright © 2006, Oracle. All rights reserved. EM Performance Pages

3-7 Copyright © 2006, Oracle. All rights reserved.

3-8 Copyright © 2006, Oracle. All rights reserved. Viewing the Alert Log Database Home page > Related Links region > Alert Log Content

3-9 Copyright © 2006, Oracle. All rights reserved. Using Alert Log Information to Aid in Tuning The alert log file contains the following information that can be used to aid in tuning the database: Incomplete checkpoints Time to perform archiving Instance recovery start and complete times Deadlock and timeout errors Checkpoint start and end times

3-10 Copyright © 2006, Oracle. All rights reserved.

3-11 Copyright © 2006, Oracle. All rights reserved. User Trace Files Server-process tracing can be enabled or disabled at the session or instance level.(sql_trace=true) A user trace file contains statistics for traced SQL statements in that session. User trace files are created on a per server process basis. User trace files can also be created by: –Performing a – ALTER DATABASE BACKUP CONTROL FILE TO TRACE –Process errors

3-12 Copyright © 2006, Oracle. All rights reserved. Background Process Trace Files The Oracle database server dumps information about errors detected by any background process into trace files. Oracle Support uses these trace files to diagnose and troubleshoot. These files do not usually contain tuning information. Ora_processname_PID.trc / bdump

3-13 Copyright © 2006, Oracle. All rights reserved. Dynamic Performance Views Dynamic performance views provide access to information about changing states and conditions in the instance. Session data Wait events Memory allocations Running SQL UNDO usage Open cursors Redo log usage And so on Oracle instance

3-14 Copyright © 2006, Oracle. All rights reserved. Dynamic Performance Views: Usage Examples SQL> SELECT sql_text, executions 2 FROM v$sqlstats 3 WHERE cpu_time > ; SQL> SELECT * FROM v$session 2 WHERE machine = 'EDRSR9P1' and 3 logon_time > SYSDATE - 1; SQL> SELECT sid, ctime 2 FROM v$lock WHERE block > 0; a b c

3-15 Copyright © 2006, Oracle. All rights reserved. Dynamic Performance Views: Considerations These views are owned by SYS. Different views are available at different times: –The instance has been started. –The database is mounted. –The database is open. You can query V$FIXED_TABLE to see all the view names. These views are often referred to as “v-dollar views.” Read consistency is not guaranteed on these views because the data is dynamic.

3-16 Copyright © 2006, Oracle. All rights reserved. Statistic Levels STATISTICS_LEVEL BASIC TYPICALALL Recommended default value Additional statistics for manual SQL diagnostics Disable all self-tuning capabilities V$STATISTICS_LEVEL

3-17 Copyright © 2006, Oracle. All rights reserved.

3-18 Copyright © 2006, Oracle. All rights reserved. Statistics and Wait Events Statistics Wait events Reports Dynamic performance views

3-19 Copyright © 2006, Oracle. All rights reserved. System Statistic Classes Cache Debug RAC SQL Redo User Enqueue OS V$SYSSTAT V$SESSTATV$STATNAME System statistic classes

3-20 Copyright © 2006, Oracle. All rights reserved. Displaying Systemwide Statistics V$SYSSTAT STATISTIC# NAME CLASS VALUE V$SGASTAT POOL NAME BYTES V$EVENT_NAME EVENT NUMBER NAME PARAMETER1 PARAMETER2 PARAMETER3 V$SYSTEM_EVENT EVENT TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED AVERAGE_WAIT

3-21 Copyright © 2006, Oracle. All rights reserved.

3-22 Copyright © 2006, Oracle. All rights reserved. Displaying Session-Related Statistics V$STATNAME STATISTIC# NAME CLASS V$SESSTAT SID STATISTIC# VALUE V$SESSION_WAIT SID SEQ# EVENT P1/2/3 P1/2/3 TEXT P1/2/3 RAW WAIT TIME SECONDS_IN_WAIT STATE V$SESSION SID SERIAL# USERNAME OSUSER V$SESSION_EVENT SID EVENT TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED AVERAGE_WAIT MAX_WAIT V$EVENT_NAME EVENT# NAME PARAMETER1 PARAMETER2 PARAMETER3

3-23 Copyright © 2006, Oracle. All rights reserved.

3-24 Copyright © 2006, Oracle. All rights reserved. Displaying Service-Related Statistics V$SERVICE_STATS SERVICE_NAME_HASH SERVICE_NAME STAT_ID STAT_NAME VALUE V$SESSION_WAIT_CLASS SERVICE_NAME SERVICE_NAME_HASH WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS TOTAL_WAITS TIME_WAITED V$SERVICES SERVICE_ID NAME NAME_HASH NETWORK_NAME CREATION_DATE V$SERVICE_EVENT SERVICE_NAME SERVICE_NAME_HASH EVENT EVENT_ID TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED AVERAGE_WAIT MAX_WAIT TIME_WAITED_MICRO

3-25 Copyright © 2006, Oracle. All rights reserved.

3-26 Copyright © 2006, Oracle. All rights reserved. Wait Events A collection of wait events provides information about the sessions that had to wait or must wait for different reasons. These events are listed in the V$EVENT_NAME view, which has the following columns: – EVENT# – NAME – PARAMETER1 – PARAMETER2 – PARAMETER3

3-27 Copyright © 2006, Oracle. All rights reserved. Commonly Observed Wait Events Over-commit, I/OLog file sync Log buffer I/OLog buffer space LatchesLibrary cache waits Locks Enqueue waits (enq:) I/O, SQL TuningDb file scattered read, Db file sequential read Buffer cache, DBWR, I/OFree buffer waits Buffer cache, DBWRBuffer busy waits AreaWait Event

3-28 Copyright © 2006, Oracle. All rights reserved. Wait Classes Scheduler Cluster Configuration Commit Application Administrative Network User I/O Concurrency System I/O Other Idle Background processes I/O Foreground processes I/O DBA commands Should be rare Inadequate database/ instance configuration Resource manager RAC resources User application code Inactive sessions Network messaging log file sync Internal database resources V$SESSION_WAIT_CLASS V$SERVICE_WAIT_CLASS V$SYSTEM_WAIT_CLASS V$EVENT_NAME Wait classes

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

3-30 Copyright © 2006, Oracle. All rights reserved. Using the V$EVENT_NAME View NAME PARAMETER1 PARAMETER2 PARAMETER PL/SQL lock timer duration alter system set mts_dispatcher waited buffer busy waits file# block# id library cache pin handle addr pin address 0*mode+name log buffer space log file switch (checkpoint incomplete) transaction undo seg# wrap# count rows selected. SQL> SELECT name, parameter1, parameter2, parameter3 2 FROM v$event_name;

3-31 Copyright © 2006, Oracle. All rights reserved. Wait Event Statistics These views hold session-level wait event statistics: V$SESSION_EVENT : Session waits by event for each session that had to wait V$SESSION_WAIT : Session waits by event for current active sessions that are waiting V$SYSTEM_EVENT : Total waits for an event, all sessions together

3-32 Copyright © 2006, Oracle. All rights reserved. Using the V$SESSION_EVENT View SID EVENT TOTAL_WAITS AVERAGE_WAIT buffer busy waits db file sequential read file open SQL*Net message to client SQL*Net more data to client SQL*Net message from client 76 0 SQL> SELECT sid, event, total_waits,average_wait 2 FROM v$session_event 3 WHERE sid=10;

3-33 Copyright © 2006, Oracle. All rights reserved. Using the V$SESSION_WAIT View SID SEQ#EVENTWAITSTATE TIME pmon timer0WAITING 21697rdbms ipc message0WAITING 3183rdbms ipc message0WAITING 44688rdbms ipc message0WAITING 5114smon timer0WAITING 614SQL*Net message from client-1WAITED SHORT TIME SQL> SELECT sid, seq#, event, wait_time, state 2 FROM v$session_wait;

3-34 Copyright © 2006, Oracle. All rights reserved.

3-35 Copyright © 2006, Oracle. All rights reserved. Using the V$SYSTEM_EVENT View EVENTTOTAL_TOTAL_TIME_AVERAGE_ WAITSTIMEOUTSWAITEDWAIT latch free5551 pmon timer process startup buffer busy waits rows selected. SQL> SELECT event, total_waits, total_timeouts, 2 time_waited, average_wait 3 FROM v$system_event;

3-36 Copyright © 2006, Oracle. All rights reserved. Precision of System Statistics Views that include microsecond timings: – V$SESSION_WAIT, V$SYSTEM_EVENT, V$SERVICE_EVENT, V$SESSION_EVENT ( TIME_WAITED_MICRO column) – V$SQL, V$SQLAREA ( CPU_TIME, ELAPSED_TIME columns) – V$LATCH, V$LATCH_PARENT, V$LATCH_CHILDREN ( WAIT_TIME column) – V$SQL_WORKAREA, V$SQL_WORKAREA_ACTIVE ( ACTIVE_TIME column) Views that include millisecond timings: – V$ENQUEUE_STAT ( CUM_WAIT_TIME column)

3-37 Copyright © 2006, Oracle. All rights reserved. Time Model: Overview The time model is a set of statistics that give an overview of where time is spent inside the Oracle database. All statistics use the same dimension: time. The statistics are accessible through: – V$SYS_TIME_MODEL – V$SESS_TIME_MODEL DB time represents the total time spent in database calls. Tuning goal is to reduce DB time. Using DB time, you can gauge the performance impact of any entity of the database. SQL PLSQL Connect Parse Java DB time

3-38 Copyright © 2006, Oracle. All rights reserved. Time Model Statistics Hierarchy Failed parse (out of shared memory) elapsed time DB time DB CPU Connection management call elapsed time Sequence load elapsed time SQL execute elapsed time Parse time elapsed Hard parse elapsed time Hard parse (sharing criteria) elapsed time Hard parse (bind mismatch) elapsed time Failed parse elapsed time PL/SQL execution elapsed time Inbound PL/SQL RPC elapsed time PL/SQL compilation elapsed time Java execution elapsed time Repeated bind elapsed time Background elapsed time Background CPU time RMAN CPU time (backup/restore)

3-39 Copyright © 2006, Oracle. All rights reserved. Notes only slide

3-40 Copyright © 2006, Oracle. All rights reserved. Practice Overview: Use Basic Tools This practice covers the following topics: Use the alert log information for tuning View system statistics View wait events

3-41 Copyright © 2006, Oracle. All rights reserved. Summary In this lesson, you should have learned how to: Identify dynamic performance views useful in tuning Identify key tuning components of the alert log file Identify key tuning components of user trace files Use dynamic performance views to view statistics and wait events

3-42 Copyright © 2006, Oracle. All rights reserved.