“this presentation is for informational purposes only and ... · pdf fileexploring the...

44
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”

Upload: phungdan

Post on 17-Mar-2018

219 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”

Page 2: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not

a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decision. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole

discretion of Oracle.

Page 3: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database
Page 4: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Oracle Database 10g Self-Management

Framework Internals : Exploring the Automatic Workload Repository

Page 5: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Gary NgaiAWR Project Lead

Mike FengAWR Development

Mark RamacherManager (Database Manageability Infrastructure)

Page 6: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Agenda

• Automatic Workload Repository (AWR) Behavior and Controls

• Statistics Stored in AWR

• Viewing AWR Statistics

Page 7: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Intelligent Infrastructure

Application & SQLManagement

System ResourceManagement

SpaceManagement

Backup & RecoveryManagement

StorageManagement

Database Control

Database Management

Oracle Database 10g –Self-Managing Database

Page 8: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Intelligent Infrastructure Overview

• Automatic Workload Repository • “Data Warehouse” of Database• Code instrumentation

• Automatic Maintenance Tasks• Pre-packaged, resource

controlled• Server-generated Alerts

• Push vs. Pull, Just-in-time, Out-of-the-box

• EM Adaptive thresholds• Advisory Infrastructure

• Integrated, uniformity• ADDM, SQL Tuning and other

Advisors

Intelligent Infrastructure

Application & SQLManagement

System ResourceManagement

SpaceManagement

Backup & RecoveryManagement

StorageManagement

Database Manageme

ntAutomatic Workload Repository

Automatic Maintenance Task Infrastructure

Server-generated Alert Infrastructure

Advisory Infrastructure

Page 9: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Automatic Workload Repository (AWR)

• Automatically collects and persists database instance statistics

• An “automated” STATSPACK++• On by default in Oracle Database 10g• Stores data in SYSAUX tablespace• Provides DBA_HIST views to view contents

Page 10: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Uses for AWR Data

• Provides performance data to database advisors (Ex. ADDM)

• Provides performance data to auto tuning/management algorithms

• Supports historical manual tuning• Period analysis• Period comparison

Page 11: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Agenda

• Automatic Workload Repository (AWR) Behavior and Controls

• Statistics Stored in AWR

• Viewing AWR Statistics

Page 12: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

AWR Snapshots

• AWR collects “snapshots” of database statistical data every hour

• Captures data directly from memory into SYSAUX tablespace into wrh$ and wri$ tables.

• Capture frequency can be adjusted up or down

• MMON background process manages automatic collection

• MMON slaves (ex. M000) run snapshots

Page 13: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

AWR Snapshots

• Assigned unique sequence based Ids• Tuning involves a range of snapshots

• Time aligned for easier comparisons• To the hour by default

• Coordinated across RAC instances• Every RAC instance writes snapshot data with

same ID, qualified by Instance ID

Page 14: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Instance 1

RAC Snapshots

AWR

MMON

DBA_HIST_SNAPSHOT

MMON Slave

Instance 2

MMON

Instance 3

MMON

MMON Slave

MMON Slave

DBA_HIST_SYSTATDBA_HIST_SEGSTAT…

Page 15: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

AWR Snapshots

• AWR supports manual snapshot creation• Run from user session• Useful for benchmarks and other controlled

performance runs• Alters the snapshot sequence “stream”

• Top SQL and segments are calculated as of the last snapshot

DBMS_WORKLOAD_REPOSITORY.create_snapshot();

Page 16: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

AWR Purging

• AWR purges snapshot data after it is older than the retention period

• Default retention is seven days• Recommend it is adjusted to one business cycle

• Most snapshot data is stored in partitions• Purge operation implemented as drop partition

Page 17: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

SYSAUX Sizing Guidelines

50000

5000

500

#User Objects

5 GB32100Large

2 GB820Medium

0.5 GB210Small

Space Required(7 days)

#CPUsActive Sessions (not Users)

Use utlsyxsz.sql script for more exact size recommendation

Data point from Large System: 13 GB AWR for 30 days of data10.1.0.3, 10K concurrent users, Avg. 100 active sessions, 6 TB, 4 x Sun E15K, each 36 CPUs, 100 GB RAM, 60 Oracle Apps Modules

Page 18: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

AWR Preserved Snapshots (Baselines)

• AWR supports the creation of AWR baselines• A named series of snapshots• Overrides AWR purging

• Baselines can be used for future comparisons• Recommended creation for peak load periods

DBMS_WORKLOAD_REPOSITORY.create_baseline(456, 459, ‘MARCH_05_PEAK’);

Page 19: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

AWR - STATSPACK Comparison

• AWR manages its own space usage• AWR is “internal” so can optimize collection

cost and space• STATSPACK is implemented in PL/SQL

• AWR collects ASH data• AWR maintains delta values for TOP SQL and

Top Segment statistics (reset each snapshot)

Page 20: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Agenda

• Automatic Workload Repository (AWR) Behavior and Controls

• Statistics Stored in AWR

• Viewing AWR Statistics

Page 21: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Statistic Types

• Counter statistics• Ex. “session logical reads”

• Value statistics• Ex. “logons current”

• Time Statistics• Ex. “DB time”

• Metrics• Ex. “DB Block Gets Per Txn”

• Sampled• Active Session History (ASH)

Page 22: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Statistics Aggregations

• Represent a dimension of statistics collection• System* -> V$SYSTAT• Session -> V$SESSTAT• Service* -> Designated in TNS connection• SQL Statement* -> V$SQLSTATS• Segment* -> V$SEGSTAT• Module-Action -> Instrumented in application• Client ID -> True end user provided by mid-tier

* - Collected in AWR snapshots

Page 23: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Wait Events and Classes

• Wait events represent sessions waiting for external events

• Waiting for resources to be released (latches, locks), services to be performed (I/O, process creation), user to submit work (idle)

• Time and counter statistics are collected for each wait event

• Over 800 wait events, classified into wait classes

• 12 wait classes organized by solution area

Page 24: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Wait Classes

Wait classes: Logical group of wait eventsAdministration

– backups, index rebuildsApplication

– row/table locks, user locksCluster

– RAC waitsCommit

– log file syncConcurrency

– buffer busy, latchesConfiguration

– free buffer waits, log buffer spc

Idle– rdbms ipc msg, smon timer

Network– SQL*Net

Scheduler– Resource manager

System I/O– db file // write, log file // write

User I/O– reads, direct writes

Other– rarely seen miscellaneous waits

Page 25: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Time Model Statistics

• Set of time statistics• Complements the wait event model• Implemented to support ADDM rules

• Measures time lost to specific tuning issues• Guides tuning efforts

• V$SYS_TIME_MODEL• DBA_HIST_SYS_TIME_MODEL

Page 26: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

DB Time

Query for Henry Miller

Novels

Browse andRead

Reviews

Add item to

cart

Checkout using

‘one-click’

DB time

DB Time = Work done by Database on behalf of ALL users= Sum of time spent by ALL users (Waiting on Non-idle events

+ on CPU + waiting for CPU)

User1

Page 27: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Active Session History (ASH)

• Captures samples of current state of every active (in database call) session

• Sample frequency is one second• Writes samples to circular buffer in SGA• AWR snapshots capture a “sample” of ASH

samples from last hour• If buffer fills before snapshot -> emergency flush

• Light-weight statistics collection mechanism

Page 28: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

DB Time

Query for Henry Miller

Novels

Browse andRead

Reviews

Add item to

cart

Checkout using

‘one-click’

Active Session History (ASH)

Page 29: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

DB Time

Query for Henry Miller

Novels

Browse andRead

Reviews

WAITING

Statedb file sequential readqa324jffritcf2137:38:26

EventSQL IDModuleSIDTime

CPUaferv5desfzs5Get review id2137:42:35

WAITING log file syncabngldf95f4deOne click2137:52:33

WAITING buffer busy waithk32pekfcbdfrAdd to cart2137:50:59

Add item to

cart

Checkout using

‘one-click’

Book by author

Active Session History (ASH)

Page 30: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Top SQL

• AWR snapshots collect the top SQL for various criteria

• Elapsed Time, CPU Time, Parse Calls, Shared Memory, and Version Count

• Delta values of each criteria statistic are maintained and reset every snapshot

• Captured: SQL Text, SQL Statistics, SQL Plans, Bind Types, Bind Values, Optimizer Environment

Page 31: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Top SQL

• The default number of SQL collected for each criteria is controlled by STATISTICS_LEVEL

• “typical” = 30, “all” = 100, “basic” = 0• Oracle Database 10g Release 2 provides a

manual control• Specific number or “MAXIMUM”

DBMS_WORKLOAD_REPOSITORY.modify_snapshot_settings(topnsql => 200);

Page 32: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Top Segments• AWR collects V$SEGSTAT statistics for hot

segments (tables, indexes, etc.) in the database

• Top segments are determined by the following criteria:

• Logical and physical reads• Wait count (sum of ITL, row lock, buffer busy)• RAC interconnect activity• Size change over last snapshot period• Access of chained rows

Page 33: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Operating System Statistics

• Oracle Database 10g exposes OS statistics through V$OSSTAT

• Includes CPU count, CPU usage and memory usage

• Oracle Database 10g Release 2 -> paging information

• OS specific• Collected by AWR snapshots

• Available through DBA_HIST_OSSTAT

Page 34: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Agenda

• Automatic Workload Repository (AWR) Behavior and Controls

• Statistics Stored in AWR

• Viewing AWR Statistics

Page 35: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

AWR Report

• AWR report displays all statistics captured over a snapshot range

• Roughly equivalent to the STATSPACK report• Available through EM• Manual creation through supplied SQL*Plus

script • awrrpt.sql

Page 36: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

AWR Compare Period Report

• AWR Compare Period report provides comparison of two snapshot periods

• Results are ordered by the statistical differences between the periods

• Statistics are normalized by “DB time”• Periods of different length can be compared

• Available through EM• Manual creation through supplied SQL*Plus script

• awrddrpt.sql

Page 37: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Compare Period Report Example (Partial)

Top Wait Events Compared side-by-side

Page 38: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Compare Period Report Example (Partial)

DB Configuration Settings Compared…

Page 39: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

AWR ASH Report

• Detailed analysis of ASH data over small periods of time (ex. 5 minutes)

• Spike analysis• Analyzes data along time, session, SQL, etc.

dimensions• Available through EM• Manual creation through supplied SQL*Plus

script• ashrpt.sql

Page 40: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

ASH Report Example (Partial)

Page 41: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

AWR SQL Details Report

• The AWR SQL Details report provides information about one or more SQL statements over a snapshot range

• SQL stats and execution plans• Very useful for finding plan changes over a

period• Manual creation through supplied SQL*Plus

script• awrsqrpt.sql

Page 42: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

AWR Conclusion

• Handles performance data out of the box• Minimizes performance overhead and

manages its own space• Handles many types and classes of statistics• Supports self-management features but can

also support manual tuning efforts through provided reports and views

Page 43: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database

Q U E S T I O N SQ U E S T I O N SA N S W E R SA N S W E R S

Page 44: “This presentation is for informational purposes only and ... · PDF fileExploring the Automatic Workload Repository. Gary Ngai AWR Project Lead ... • On by default in Oracle Database