This presentation is for informational purposes only and

This presentation is for informational purposes only and
“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 Ngai
AWR Project Lead
Mike Feng
AWR Development
Mark Ramacher
Manager (Database Manageability
Infrastructure)
Agenda
• Automatic Workload Repository (AWR)
Behavior and Controls
• Statistics Stored in AWR
• Viewing AWR Statistics
Oracle Database 10g –
Self-Managing Database
Application & SQL
Management
Storage
Management
Database
Control
System Resource
Management
Database
Backup & Recovery
Management
Management
Intelligent
Infrastructure
Space
Management
Intelligent Infrastructure Overview
•
Advisory
Application
& SQL
Management
Infrastructure
Storage
System
Resource
Server-generated
Alert
Management
Management
Infrastructure
•
•
•
•
Intelligent
Repository
Infrastructure
Pre-packaged, resource
controlled
Server-generated Alerts
•
•
•
“Data Warehouse” of Database
Code instrumentation
Automatic Maintenance Tasks
•
Automatic Maintenance Task
InfrastructureSpace
Backup & Recovery
Management Database Management
Manageme
AutomaticntWorkload
Automatic Workload Repository
Push vs. Pull, Just-in-time, Outof-the-box
EM Adaptive thresholds
Advisory Infrastructure
•
•
Integrated, uniformity
ADDM, SQL Tuning and other
Advisors
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
RAC Snapshots
MMON
MMON Slave
Instance 1
AWR
MMON
MMON Slave
yDBA_HIST_SYSTAT
yDBA_HIST_SEGSTAT
y…
Instance 2
MMON
Instance 3
DBA_HIST_SNAPSHOT
MMON Slave
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
Active
Sessions (not
Users)
#CPUs
#User
Objects
Space
Required
(7 days)
Small
10
2
500
0.5 GB
Medium
20
8
5000
2 GB
Large
100
32
50000
5 GB
Use utlsyxsz.sql script for more exact size
recommendation
Data point from Large System: 13 GB AWR for 30 days of data
10.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
y Wait classes: Logical group of wait events
yAdministration
–
backups, index rebuilds
yApplication
–
row/table locks, user locks
yCluster
–
RAC waits
yCommit
–
log file sync
yConcurrency
– buffer busy, latches
yConfiguration
–
free buffer waits, log buffer spc
yIdle
–
rdbms ipc msg, smon timer
yNetwork
–
SQL*Net
yScheduler
–
Resource manager
ySystem I/O
–
db file // write, log file // write
yUser I/O
– reads, direct writes
yOther
–
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
User1
Query for
Henry Miller
Novels
Browse and
Read
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)
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
Active Session History (ASH)
Query for
Henry Miller
Novels
DB Time
Browse and
Read
Reviews
Add
item to
cart
Checkout
using
‘one-click’
Active Session History (ASH)
Query for
Henry Miller
Novels
Browse and
Read
Reviews
Add
item to
cart
Checkout
using
‘one-click’
DB Time
Time
SID
Module
7:38:26
213
Book by author
7:42:35
213
7:50:59
7:52:33
SQL ID
State
Event
qa324jffritcf
WAITING
db file
sequential read
Get review id
aferv5desfzs5
CPU
213
Add to cart
hk32pekfcbdfr
WAITING
buffer busy wait
213
One click
abngldf95f4de
WAITING
log file sync
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
QUESTIONS
ANSWERS
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement