“this presentation is for informational purposes only and ... · pdf fileexploring the...
TRANSCRIPT
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
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.
Oracle Database 10g Self-Management
Framework Internals : Exploring the Automatic Workload Repository
Gary NgaiAWR Project Lead
Mike FengAWR Development
Mark RamacherManager (Database Manageability Infrastructure)
Agenda
• Automatic Workload Repository (AWR) Behavior and Controls
• Statistics Stored in AWR
• Viewing AWR Statistics
Intelligent Infrastructure
Application & SQLManagement
System ResourceManagement
SpaceManagement
Backup & RecoveryManagement
StorageManagement
Database Control
Database Management
Oracle Database 10g –Self-Managing 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
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
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
Agenda
• Automatic Workload Repository (AWR) Behavior and Controls
• Statistics Stored in AWR
• Viewing AWR Statistics
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
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
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…
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();
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
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
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’);
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)
Agenda
• Automatic Workload Repository (AWR) Behavior and Controls
• Statistics Stored in AWR
• Viewing AWR Statistics
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)
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
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
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
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
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
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
DB Time
Query for Henry Miller
Novels
Browse andRead
Reviews
Add item to
cart
Checkout using
‘one-click’
Active Session History (ASH)
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)
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
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);
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
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
Agenda
• Automatic Workload Repository (AWR) Behavior and Controls
• Statistics Stored in AWR
• Viewing AWR Statistics
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
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
Compare Period Report Example (Partial)
Top Wait Events Compared side-by-side
Compare Period Report Example (Partial)
DB Configuration Settings Compared…
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
ASH Report Example (Partial)
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
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
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