ORACLE DATABASE 10GR2: AN ENLIGHTENED REVISIT (BEFORE WE GIVE UP AND MOVE TO 11G!

)
John Kanagaraj, DB Soft Inc Expert Session #319 (2 hour)

Speaker Qualifications
‡ ‡ ‡ ‡ ‡ ‡ John is a Principal Consultant @ DB Soft Inc. Executive Editor for IOUG¶s SELECT Journal Co-author of ³Oracle Database 10g Insider Solutions´ Technical Editor for various books Frequent presenter ± IOUG/OAUG/OOW/NoCOUG Published in SELECT, OAUG Insight, SQL Server Magazine and other publications ‡ Recognized by Oracle Corp as an ³Oracle ACE´

SELECT: Call for Articles/Reviewers
± The SELECT Journal is IOUG¶s Technical Quarterly ± Distributed to all IOUG members worldwide ± Yearly Best Practices and Tips booklet ‡ Submit an article or Review one! ‡ Contact µselect@ioug.org¶

What this presentation is about
‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ Oracle Database 10g now in ³full production´ mode R1 released in 2003 (?), R2 in 2005 (?) A little history lesson ± book, papers Lead time between books/initial articles and ³consolidation´ / ³better understanding´ Need to revisit and update the ³first revelation´ Reconsider ³new features´ ± fresh look Hidden surprises and little bonuses A peek into the future ± 11g titbits

Audience survey
‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ Using Oracle Database 11g in production? Still using Oracle 7 or 8i? Migrating to Oracle Database 10g? Read the ³New features´ manual for every release? Used Advisories in 9i? Used Active Session History for troubleshooting? Read AWR/ADDM/ASH reports? Used SQL Profiles to fix SQL issues?

Overview of new perf features ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ Strictly related to performance related features Need to ³unlearn the old and embrace the new´ AWR ± The Performance Warehouse ASH ± What happened to the sessions?!? ADDM ± Your inbuilt (and unpaid!) expert Tuning advisors ± Bonus freebies In-Memory metrics and Server generated alerts Where to look for more details .

Philosophy behind Oracle DB 10g ‡ Automation ± Incremental steps in 9i (Advisors. Time) ± Most significant change in Performance management ± ³Out of the box´ setups ± GUI ³hides´ the complexity (and details!) ‡ Consistency ± Common/Unified interface ± Stats storage and presentation ± Interpretation .

Reality check before we proceed ‡ Licensing changes in Oracle Database 10g ‡ A tale of two packs: ± Oracle Diagnostic Pack ‡ Automatic Workload Repository (AWR) ‡ Automatic Database Diagnostic Monitor (ADDM) ‡ Monitoring and Event notifications and history ± Oracle Tuning Pack ‡ SQL Access Advisor ‡ SQL Tuning Advisor and STS ‡ Object Advisor ‡ Required even to access Views directly!!! .

stores performance data ± ± ± ± ± Direct memory access (MMNL/MMON) In-memory component (V$/Metric views) ³Persisted´ in WR tables (SYSAUX) 162 tables ± WRI$.AWR ² Performance Warehouse ‡ Performance Data Warehouse for 10g ‡ Basis for most of the problem detection and reporting ‡ AWR collects. WRH$. WRM$ Exposed via DBA_HIST_* Views ‡ Self managing ³out of the box´ ‡ Set retention. baseline . frequency.

access counts for segments Snapshots of V$ and some Metrics Host CPU and Memory statistics (V$OSSTAT) Baseline information ³Management´ type information ± Snapshot details ± Advisor and other parameters .AWR Contents ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ Active Session History (ASH) High-load SQL statements Time model statistics (both System/Session) Object usage .

AWR ² ´Statspack on Steroidsµ ‡ ‡ ‡ ‡ ‡ ‡ Similar to STATSPACK ³snapshots´ Reportable ± AWRRPT. even for SQL access! .SQL AWR snapshot automatically analyzed Accessible via GUI and API/SQL (*) High-impact SQL captured differently Stores session level info as well * Read the fine print : License required.

SQL Execution statistics for specific SQL statement using AWRSQRPT.SQL . data not purged View using WRM$_BASELINE/DBA_HIST_BASELINE Reports diff via AWRDDRPT.AWR Baselining and comparison ‡ ‡ ‡ ‡ ‡ ‡ Enables performance ³baselining´ Collection of two or more snapshots Stored in ³_BL´ tables.

ASH ² What·s up with sessions ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ Historical view of active sessions Active sessions sampled every second Stored in circular memory buffer Every 10th sample persisted in AWR V$ACTIVE_SESSION_HISTORY : ³In-memory´ WRH$_ACTIVE_SESSION_HISTORY : ³Persisted´ Enables ³after-the-fact´ analysis!!! Reported via ASHRPT (Not available in 10gR1) ³Slice-and-dice´ analysis can reveal a lot of info .

ASH ² Session states exposed! ‡ ³On-the-spot´ analysis ‡ Retroactive analysis ± From memory buffer (V$ACTIVE_SESSION_HISTORY) ± From persisted AWR data (WRH$_ACTIVE_SESSION_HISTORY connected via SNAP_ID) ± Supports manual drill down from AWR/ADDM ‡ Tracks High load SQL execution behavior ‡ Determine Blocking sessions and ³hot´ segments ‡ SESSION_STATE : ³ON CPU´ or ³WAITING´ .

³DB Time´ (qualitative!) Oracle DB 11g ± new ³Instance ADDM´ .ADDM ² Your unpaid Tuning Expert! ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ Starting point for most investigations Runs after every AWR snapshot Determines and records performance issue Recommends corrective action Generates probable benefit Suggest use of other advisors Common currency .

ADDM ² Partial check list ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ CPU bottlenecks Excessive parsing Lock contention Concurrency I/O capacity Incorrect sizing of Oracle memory and file structures High-load SQL. Java and PL/SQL statements Poor connection management Hot objects RAC-specific issues .

ADDM ² Findings/Recommendations ‡ ‡ ‡ ‡ ‡ ‡ Qualitative rather than Quantitative analysis Hardware changes Database-configuration changes Schema-level changes Application changes Using other advisors (for example) ± SQL Tuning Advisor / SQL Access Advisor ± Segment Advisor ‡ Don¶t stare at the screen ± Use SQL to summarize ± Details in my 2007 paper .

Advisors ² A step beyond ‡ Builds on 9i advisors ± ± ± ± ± Buffer cache advisor Shared pool advisor MTTR (Mean Time To Recover) advisor Summary (MVIEW) advisor PGA Target Advisor ‡ New in 10g ± SQL Tuning Advisor ± SQL Access Advisor ± Segment Advisor .

SQL Tuning Advisor ‡ ‡ ‡ ‡ Frontend to Automatic Tuning Optimizer Extension (reuse) of Optimizer (CBO) Performs ³what-if´ analysis Not restricted by ³time to optimize´ (_optimizer_max_permutations = 2000) ‡ The following advice is provided ± Gather missing or stale statistics ± Create new indexes ± Restructure SQL statement ± SQL profiles .

SQL Tuning Advisor ‡ SQL Profile ± Collects additional information via sampling/partial execution techniques ± Verifies and adjusts CBO¶s estimates at runtime ± Similar in function to Outlines ± Enabled by category : ³test-and-set´ ± Access/manipulate ± DBMS_SQLTUNE ± Precedence given to Stored Outlines ± Runs against individual SQL or SQL Tuning Sets (STS) .

Drop unused indexes. Module) ‡ ‡ ‡ ‡ Segment Advisor Undo Advisor Memory Advisor Metrics and Server Generated Alerts .Other Advisors ‡ SQL Access Advisor ± ± ± ± ± Works alongside SQL Tuning Advisor Advice on MV. MV logs Considers space usage vs performance Inputs: STS. Filters (Top N. User-defined. Hypothetical Advanced: Workload type (RO). Indexes.

g.Avoiding Advisor Pitfalls ‡ Out-of-the-box thinking (redesign. new code. Index non-usage) ‡ Changing workload or environment (additional load. H/W or S/W changes) . rethink approach) ‡ False positives (check validity for all situations ± e.

Features revisited ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ STATSPACK ± Not dead yet! New and changed views ± tons of goodies! Event Breakout ± Greater visibility Mutexes ± Boon or Bane? Operating System Statistics ± all in one place Time and Wait Model ± aids better understanding Hidden Surprises ± watch out! Useful AWR sections ± Segstats and much more Extracting Data from AWR ± Drill down example DBMS_XPLAN ± in-depth view .

STATSPACK ² Not dead yet! ‡ STATSPACK is still available in Oracle DB 10g ‡ No license required to track performance stats ‡ Setup/maintenance/reporting : same as before ± Default is Level 5. File and Temp) Additional SQL sections in Report ‡ Comparison to AWR ‡ Check Metalink Note: 394937. set at Level 7 to get Segment stats ‡ Number of new sections available ± ± ± ± OS Statistics DB Time reporting Response time Histograms (Event.1 (incomplete) .

STATSPACK ² Host Statistics Host CPU ~~~~~~~~ (CPUs: 32) Load Average Begin End ------.-----------Host Mem (MB): 65.6 % Host Mem used for SGA+PGA: 12.04 0.0 PGA use (MB): 2.8 ------------------------------------------------------------- .64 81.------.38 1.03 User System Idle WIO WCPU ------.8 2.------.90 Begin End -----------.------.274.144.7 SGA use (MB): 6.144.-------3.274.038.------0.233.5 12.06 95.Resource Mgr: Memory Statistics ~~~~~~~~~~~~~~~~~ 3.56 3.7 65.13 ####### Instance CPU ~~~~~~~~~~~~ % of total CPU for Instance: % of busy CPU for Instance: %DB time waiting for CPU .0 6.

sql) % of total CPU for Instance:' ch45n. of CPUs) ± Usually present when load is high (queue depth/wait for CPU) ‡ Note memory statistics ± tracked in V$OSSTAT ‡ This section not reported in AWR Report!!! . 100* ((:dbcpu+:bgcpu)/1000000) / ((:btic)/100) pctval ‡ Available in Time Model (V$SYS_TIME_MODEL) ‡ Discrepancy between estimated and actual CPU ± (Busy_Time + Idle_Time) vs.STATSPACK ² Host Statistics ‡ Calculation of Total and Busy CPU (spcpkg. 100* ((:dbcpu+:bgcpu)/1000000) / (:ttics) pctval % of busy CPU for Instance:' ch45n.secs * No.of. (No.

----.1 SQL*Net message to dblink 683 100.7 .5 3.----.1 gc cr failure 1 100.----.2 1.2 4.5 3.4 23.1 53.0 .8 18.4 .0 <snip> SQL*Net break/reset to cli 2276 99.0 .1 95.9 enq: WL .8 enq: WF .0 gc buffer busy 1893 74. G is 1000000000 -> % of Waits .7 gc cr block congested 117 3.value: .4 11.4 1.4 7.5 4.5 .1 42.----.6 .6 25.----. M is 1000000.% of Waits -----------------Event Waits <1ms <2ms <4ms <8ms <16ms <32ms <=1s >1s -------------------------.05%.9 8.3 28.5 .7 gc cr block busy 33K 21.----enq: TX .3 .1 .9 gc cr disk read 1626 99.3 . >1s is truly >=1024ms -> % of Waits .6 1.contention 4 75.column heading: <=1s is truly <1024ms.1 .0 14.2 .0 5.5 5.4 3.1 .8 .0 <snip> db file scattered read 2070K 91.----.contention 7 57.4 2.1 .0 indicates value was &lt.0 .0 25.0 db file sequential read 1413K 96.2 6.----.units: K is 1000.5 .row lock content 7561 4. null is truly 0 -> Ordered by Event (idle events last) Total ----------------.3 .0 .0 .4 1.2 SQL*Net message from dblin 683 43.STATSPACK ² Response Histograms Wait Event Histogram DB/Inst: MYRAC/MYRAC1 Snaps: begin_snap-end_snap -> Total Waits .----.0 4.0 27.

Client traffic ‡ SQL*Net message to client (and ³to dblink´) ± Inter server ‡ gc cr block congested (Internode traffic) ± Intra instance ‡ Not present in AWR (neither snapped or reported) . bumps in wait events ± Troubleshooting network response (example later) ‡ SQL*Net break/reset to client . File and Temp ± V$EVENT_HISTOGRAM ± V$FILE_HISTOGRAM ± V$TEMP_HISTOGRAM ‡ Helpful in seeing spread.STATSPACK ² Response Histograms ‡ Response Time Histograms ‡ Snapped for Event.

rowid.STATSPACK ² New SQL sections ‡ New SQL reporting sections in Oracle DB 10g SP ± SQL ordered by CPU : From CPU_TIME in V$SQL ± SQL ordered by Elapsed: From ELAPSED_TIME in V$SQL ± SQL ordered by Cluster Wait Time: From new CLUSTER_WAIT_TIME in 10g V$SQL ‡ Report compares total time for SQL statements captured to total time reported in the DB SQL ordered by CPU DB/Inst: MYRAC/MYRAC1 Snaps: begin_snap-end_snap -> Resources reported for PL/SQL code includes the resources used by all SQL statements called by the code. step_no.13 437 2. expiration. msgid.---------.4% of Total DB CPU -> SQL reported below exceeded 1.86 29. chain_no.17 51.619.0% of Total DB CPU CPU CPU per Elapsd Time (s) Executions Exec (s) %Total Time (s) Buffer Gets ---------.9 3503. -> Total DB CPU (s): 1.-----. enq_tid. delay.--------------947. local_order_no. . enq_time.-----------. dequeue _msgid.---------.674 select q_name.826 -> Captured SQL accounts for 202. state.

New and changed views ‡ Large number of new as well as changed views ‡ (Sometimes) Inadequate documentation. but powerful uses! ‡ Classified by ± ± ± ± ± ± Services related In-memory metrics Response Histograms Extensions to existing views Interesting views Common columns .

Service related views ‡ ‡ ‡ ‡ ³Service´ concept created in Oracle 8.0 Provides ability to connection to an abstract entity SERVICE_NAME column in various views New views ± V$SERVICES : Services description (failover and load balancing information included) ± V$SERVICE_STATS : Workload statistics ± V$SERVICE_EVENT : Events by service .

806.072.MYDOM.WF_CONTROL SYS$BACKGROUND STAT_NAME VALUE -----------------------------. stat_name.WF_CONTROL SYS$BACKGROUND SYS$USERS MYRAC1.405.281 cluster wait time 798.among 28 different stats SERVICE_NAME -------------------SYS$USERS MYRAC1. -.337 cluster wait time 52.181 .---------------db block changes 34. aq_ha_notification.COM SYS$BACKGROUND SYS$USERS SQL> 2 3 4 GOAL ---------NONE NONE NONE NONE D N N N N AQ_HA_NOTIFICATION -----------------NO NO NO NO CLB_GOAL ---------LONG LONG SHORT SHORT select service_name.'db block changes').383.618.Service related views SQL> select name. value from v$service_stats where stat_name in ('cluster wait time'.MYDOM.466 cluster wait time 0 cluster wait time 4.836 db block changes 471.178 db block changes 0 db block changes 2.MYDOM. NAME -------------------APPLSYS.COM APPLSYS.456.COM APPLSYS.WF_CONTROL MYRAC1.080. dtp. clb_goal 2* from v$services.810. goal.328.

time_waited from v$service_event where event in ( 'latch: library cache'.from 114 events EVENT TOTAL_WAITS TIMEOUTS TIME_WAITED --------------------.-------.COM SYS$BACKGROUND SYS$BACKGROUND SYS$USERS SYS$USERS ‡ Ability to segment and measure workload ‡ Needs to be setup (becomes complex in RAC environments) . total_timeouts.----------.----------read by other session 25107023 23985 10848655 latch: library cache 420975 0 4352231 read by other session 29 0 14 latch: library cache 6742 0 104454 read by other session 27368974 435 3657701 latch: library cache 144347 0 734451 SERVICE_NAME ---------------MYRAC1. event.COM MYRAC1. total_waits. -.Service related views SQL> 2 3 4 5 select service_name.MYDOM. 'read by other session').MYDOM.

1 hr of 60 secs) .In-memory metrics ‡ V$METRIC/V$SYSMETRIC (V$SYSSTAT) -> V$SYSMETRIC_HISTORY ‡ V$EVENTMETRIC (V$SYSTEM_EVENT) -> V$EVENT_METRIC_HISTORY ‡ V$SYSMETRIC_SUMMARY (Avg/Min/StDev) ‡ WRH$_SYSMETRIC_SUMMARY ‡ V$METRICNAME / V$METRICGROUP ‡ Metrics -> Rate of change of statistics counters ‡ Alerts on rate -> Server Generated Alerts (changeable via EM) ‡ Short-lived (3 mins of 15 secs.

In-memory metrics SQL> select event.--------------.---------SQL*Net message to client 1 137034612 SQL*Net message to client 2 19183 SQL*Net message to client 4 9922 SQL*Net message to client 8 5446 SQL*Net message to client 16 2931 SQL*Net message to client 32 1519 SQL*Net message to client 64 752 SQL*Net message to client 128 310 SQL*Net message to client 256 111 SQL*Net message to client 512 29 SQL*Net message to client 1024 1 SQL*Net message to client 2048 1 SQL*Net more data to client 1 8582781 SQL*Net more data to client 2 34556 SQL*Net more data to client 4 22114 SQL*Net more data to client 8 20108 . wait_count 2 from v$event_histogram 3* where event like 'SQL*Net %to client' EVENT WAIT_TIME_MILLI WAIT_COUNT -----------------------------. wait_time_milli.

Existing/New views ‡ Number of existing views expanded ± V$SQL. V$SESSION ‡ Information merged from various views ± V$SESSION (V$SESSION_WAIT and V$LOCK) ‡ New visibility ± V$SQL_BIND_CAPTURE ± V$SQL_SHARED_CURSOR ‡ Common Columns ± WAIT_CLASS and related ‡ WRH Tables exposed via DBA_HIST_% views ‡ V$PROCESS_MEMORY ± session wise memory ‡ V$SQLSTATS ± Low overhead access .

V$SESSION view ‡ Wait information merged from V$SESSION_WAIT ± EVENT. SEQ#. WAIT_CLASS ‡ Lock information from V$LOCK ± BLOCKING_SESSION. BLOCKING_INSTANCE ‡ Tons of new columns ± ± ± ± ± SQL_ID (Current and Previous) SQL_CHILD_NUMBER (Current and Previous) PLSQL related information (Entry. P1 ± P3. BLOCKING_SESSION_STATUS. etc) SQL_TRACE columns (binds and waits as well) CLIENT_IDENTIFIER (DBMS_MONITOR) ‡ No need to join to V$SESSION_WAIT. Object. V$LOCK now . Subprogram.

V$SQL view ‡ Complete text in SQL_FULLTEXT ‡ Parallel execution (PX_SERVERS_EXECUTION) ‡ Different types of wait times ± ± ± ± ± ± ± ± ± ± APPLICATION_WAIT_TIME CONCURRENCY_WAIT_TIME CLUSTER_WAIT_TIME USER_IO_WAIT_TIME PLSQL_EXEC_TIME JAVA_EXEC_TIME PARSING_SCHEMA_NAME Optimizer details BIND_DATA LAST_LOAD_TIME (Docs: LAST_ACTIVE_TIME??) ‡ Additional details: .

OTHER_XML. etc.V$SQL related views ‡ V$SQL_OPTIMIZER_VIEW ± Optimizer parameters for SQL_ID and particular child cursor ‡ V$SQL_PLAN ± TIMESTAMP. ‡ DBMS_XPLAN exposes details* ‡ V$SQL_SHARED_CURSOR ± Why was a cursor not shared? ± USER_BIND_PEEK_MISMATCH column ± Groundwork for 11g bind-awareness/bind-sensitiveness ‡ V$SQL_BIND_CAPTURE ± Use with ASH to get some bind values * Undocumented : ³ADVANCED´ parameter to get OTHER_XML details . QBLOCK_NAME.

3) enq: TX .compare R1) ‡ Major change in monitoring / reporting code!!! .2.0.0.quiesce database (Waiting for DB Quiesce) enq: ST ± contention (Space transaction ± rare now with LMT) ‡ ³read by other session´ (BBW with reason code 130) ‡ Break out at all levels (session/system.2.3) ± latch: cache buffers chains ± latch: library cache ± latch: library cache pin ‡ ³enqueue´ has 205 types ± ± ± ± (10.Event Breakout ‡ Event names for ³blocking´ type events changed ‡ ³latch free´ now has 29 types (10.row lock contention (Waiting for Row lock) enq: UL ± contention (Waiting for User generated lock) enq: XR .

Mutexes ² Boon or Bane? ‡ Low overhead mechanism replacing some latches ‡ ³Simulated´ on certain platforms ± HP-UX uses a CAS (³compare-and-swap´) simulator ± This itself is a latch: quite an overhead ‡ Track using V$MUTEX_SLEEP and V$MUTEX_SLEEP_HISTORY ‡ ³_kks_use_mutex_pin = FALSE´ turns this off ‡ Snapshotted in STATSPACK. not in AWR .

0287E+11 7868502024 0 . STAT_NAME ---------------------------------------------------------------NUM_CPUS IDLE_TIME BUSY_TIME USER_TIME SYS_TIME IOWAIT_TIME AVG_IDLE_TIME AVG_BUSY_TIME AVG_USER_TIME AVG_SYS_TIME AVG_IOWAIT_TIME OS_CPU_WAIT_TIME RSRC_MGR_CPU_WAIT_TIME LOAD NUM_CPU_SOCKETS PHYSICAL_MEMORY_BYTES VM_IN_BYTES VM_OUT_BYTES VALUE ---------24 802033123 878091185 489231709 388859476 187539358 33398667 36564711 20362160 16180042 7794964 2.6867E+13 0 2.359375 24 1.Operating System Statistics ‡ Set SQL*Plus format to get right value! (issue in AWR) SQL> select stat_name. value 2 from v$osstat.

value from v$sys_time_model where value > 0.Time Model ‡ CPU breakup. updated every 3 seconds!!! SQL> select stat_name.-------------DB time 893170091346 DB CPU 176244910473 sequence load elapsed time 10215471781 parse time elapsed 4524012412 hard parse elapsed time 3657262901 failed parse elapsed time 103540062 hard parse (sharing criteria) elapsed time 365217641 hard parse (bind mismatch) elapsed time 5923514 repeated bind elapsed time 14768010 connection management call elapsed time 328536127 PL/SQL execution elapsed time 5554924592 PL/SQL compilation elapsed time 333815896 background elapsed time 13782131027 background cpu time 4572399582 . STAT_NAME VALUE --------------------------------------------.

Wait Model SQL> select wait_class. time_waited. WAIT_CLASS TIME_WAITED TOTAL_WAITS -------------------. total_waits from v$system_wait_class.---------------Other 1370371162 10777690366 Application 11031616 77468 Configuration 433075 3972043 Administrative 986 10 Concurrency 5069513044 4023651698 Commit 4187059 4606985 Idle 26816217176 1179884266 Network 1964510 152943745 User I/O 845512795 3197266600 System I/O 21813081 47778673 .---------------.

----User I/O 17 Application 12 Network 27 Concurrency 25 Administrative 46 Configuration 23 Scheduler 2 Cluster 47 Other 592 Idle 62 System I/O 24 . WAIT_CLASS COUNT(*) ----------------. count(*) from v$event_name 2 group by wait_class.Wait Class ‡ Types of wait: classified by WAIT_CLASS SQL> select wait_class.

1.1.1 Collecting System Stats does NOT invalidate shared pool ‡ System Statistics .AUX_STATS$ view See Metalink Notes: 457228. 149560. 153761.Hidden surprises ‡ GROUP BY does not ensure ORDER BY ± ± ± ± ± ± ± ± ± ± New code base avoids sort for GROUP BY operation Order was never guaranteed Large amount of legacy/custom code needs change Investigate ³_gby_hash_aggregation_enabled´ parameter ³CPU Cost´ optional in 9i Fully functional (by default) in 10g Sample collected when DB installed/upgraded Check in SYS.

Hidden surprises ‡ Dynamic sampling ± ± ± ± ± ± ± ± ± ± 9i default was 1 10g default is 2 all unanalyzed tables are sampled Number of blocks sampled: twice default number (2x32=64) Impact on Global Temp tables Impact on parse (not affected by plan permutation limits) Monitoring ON by default Used by Automatic Stats gathering (Dictionary stats included) Trigger fixed at 10%. changeable in 11g Stats collection for Fixed table (new but optional) ‡ Statistics gathering and Table monitoring .

AUTO_SAMPLE_SIZE METHOD_OPT: FOR ALL COLUMNS SIZE AUTO GRANULARITY: AUTO (For partitioned objects only) ± Automatically stores past 31 days DBA_TAB_STATS_HISTORY ± DIFF_TABLE_STATS_* function in 10.AUTO_INVALIDATE CASCADE: DBMS_STATS.AUTO_CASCADE ESTIMATE_PERCENT: DBMS_STATS.Hidden surprises ‡ DBMS_STATS ± ± ± ± 9i and below: Defaults were fixed 10g and above: Defaults can be changed (boon or bane?) Many parameters default to ³decided by Oracle´ Examples: ‡ ‡ ‡ ‡ ‡ NO_INVALIDATE: DBMS_STATS.4 .2.0.

35 GCS/GES messages received: 5.028.88 GCS/GES messages sent: 8.Useful sections: AWR Report ‡ Segment statistics in AWR report ± ± ± ± Same as ³Top 5 Segments´ in Level 7 STATSPACK reports (9i+) Segments by Global Cache Buffer Busy (RAC only.16 Global Cache Load Profile ~~~~~~~~~~~~~~~~~~~~~~~~~ .30 DBWR Fusion writes: 0.165. new section in 10g) Segments by CR Blocks Received (RAC only) Segments by Current Blocks Received (RAC only) ‡ New GC Load profile and GC Efficiency percentages Per Second Per Transaction ----------------------------Global Cache blocks received: 1.54 18.00 Estd Interconnect traffic (KB) 15.63 0.41 Buffer access .90 Global Cache blocks served: 164.remote cache %: 0.43 Buffer access disk %: 2.80 Global Cache Efficiency Percentages (Target local+remote 100%) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Buffer access .77 0.local cache %: 97.31 10.375.70 2.684.

For RAC instances and dbid = (select dbid from v$database).dba_hist_snapshot where instance_number = v_instance_number -. 1. lead(snap_id. lead(startup_time. 1) OVER (ORDER BY snap_id). startup_time.Extracting data from the AWR ‡ Complete source in paper ‡ Adaptable for different types of extracts /* This cursor fetches details of the current snapshot plus the next one using the LEAD function. We will use this to make sure that there was no DB restart in-between */ cursor snapshot is select snap_id. . 0) OVER (ORDER BY snap_id). to_char(begin_interval_time) begin_interval_time. to_char(end_interval_time) end_interval_time from sys.

instance_number.b.'NUM_CPUS'.We don't subtract for certain types such as NUM_CPUS. case when e.stat_name in ('NUM_CPU_SOCKETS'.stat_id = e.Extracting data from the AWR -.value else e.instance_number = v_instance_number. .instance_number and b.dba_hist_osstat e where b.snap_id = v_end_snap_id and b.'NUM_CPU_CORES'.value .stat_id and b. etc.'LOAD') then e.stat_name.value end stat_value from sys.instance_number = e. cursor osstat is select e.dba_hist_osstat b. e.snap_id = v_begin_snap_id and e. sys.

close snapshot. LOOP fetch snapshot into v_begin_snap_id.put_line(v_end_snap_id || '.' || v_stat_name || '. avoid the last line (lead will return 0 for end_id) if ( v_begin_startup_time = v_end_startup_time ) and ( v_end_snap_id != 0 ) then open osstat.also. v_begin_interval_time.' || v_value). END LOOP. v_end_interval_time. end if. exit when snapshot%NOTFOUND.' || to_char(v_end_interval_time. v_end_startup_time. end. close osstat. loop fetch osstat into v_instance_number. -. end loop. -.Extracting data from the AWR v_instance_number := &1. exit when osstat%NOTFOUND. v_begin_startup_time. dbms_output. v_stat_name. v_end_snap_id. . v_value.Run through only if the startup times for both snaps are same! -.Send this from command line open snapshot. 'DD-MON-YY HH24:MI') || '.

BUSY_TIME.NUM_CPUS.18-FEB-08 00:00.USER_TIME.2664727 5363.3505859375 5363.2684043 5364.23502864 5363.18-FEB-08 00:00.18-FEB-08 01:00.1716332 5364.970933 5363. -.LOAD.531265 5363.24 5363.0 -5364.PHYSICAL_MEMORY_BYTES.NUM_CPU_SOCKETS.6018339 5364.18-FEB-08 00:00.NUM_CPUS.18-FEB-08 00:00.VM_IN_BYTES.18-FEB-08 01:00.18-FEB-08 01:00.SYS_TIME.18-FEB-08 01:00.Send this from command line 5363.5975106 5363.24 5363. -.18-FEB-08 00:00.18-FEB-08 00:00.18-FEB-08 01:00.18-FEB-08 00:00.VM_OUT_BYTES.600067 <snip> .USER_TIME.18-FEB-08 00:00.18-FEB-08 00:00.IDLE_TIME.967711 5364.Send this from command line new 38: v_instance_number := 1..Extracting data from the AWR Sample output: (portion of output) SQL> @awr_osstat 1 old 38: v_instance_number := &1.18-FEB-08 00:00.24 5364.0 5363.18-FEB-08 01:00.BUSY_TIME.1693794 5363.IOWAIT_TIME.IOWAIT_TIME.18-FEB-08 00:00.IDLE_TIME.SYS_TIME.

Plan stored in the AWR ± DISPLAY_CURSOR ± V$SQL cursor cache ± DISPLAY_SQLSET . options)).´ ± Displays all child cursors if present . expanded in 10g ± DISPLAY_AWR .Plan of a given statement stored in a SQL tuning set (STS) ± Simple to use: ‡ ³select * from table(dbms_xplan.display_awr(µ<SQL_ID>¶.New features in DBMS_XPLAN ‡ Excellent alternative for EXPLAIN_PLAN ‡ Introduced in 9i.

SEL$F5BB74E1 2 .APPLICATION_ID = :1 Plan hash value: 3221072286 --------------------------------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | --------------------------------------------------------------------------------------------------------| 0 | SELECT STATEMENT | | | | 2 (100)| | | 1 | NESTED LOOPS | | 1 | 51 | 2 (0)| 00:00:01 | |* 2 | INDEX UNIQUE SCAN | FND_RESPONSIBILITY_U1 | 1 | 10 | 1 (0)| 00:00:01 | | 3 | TABLE ACCESS BY INDEX ROWID| FND_RESPONSIBILITY_TL | 1 | 41 | 1 (0)| 00:00:01 | |* 4 | INDEX UNIQUE SCAN | FND_RESPONSIBILITY_TL_U1 | 1 | | 0 (0)| | --------------------------------------------------------------------------------------------------------Query Block Name / Object Alias (identified by operation id): ------------------------------------------------------------1 .display_cursor('g6jzbgnku8024'. child number 0 ------------------------------------SELECT R.RESPONSIBILITY_ID = :1 AND R.NULL.RESPONSIBILITY_NAME FROM FND_RESPONSIBILITY_VL R WHERE R.SEL$F5BB74E1 / B@SEL$2 3 .SEL$F5BB74E1 / T@SEL$2 Outline Data ------------/*+ BEGIN_OUTLINE_DATA IGNORE_OPTIM_EMBEDDED_HINTS OPTIMIZER_FEATURES_ENABLE('10.2. PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------SQL_ID g6jzbgnku8024.3') OPT_PARAM('_b_tree_bitmap_plans' 'false') OPT_PARAM('_fast_full_scan_enabled' 'false') */ .0.New features in DBMS_XPLAN SQL> select * from table(dbms_xplan.'ADVANCED')).SEL$F5BB74E1 / T@SEL$2 4 .

:1 (NUMBER): 50357 2 .10] SQL_ID g6jzbgnku8024.ROWID[ROWID."RESPONSIBILITY_NAME"[VARCHAR2.RESPONSIBILITY_ID = :1 AND ."LANGUAGE"=USERENV('LANG')) Column Projection Information (identified by operation id): ----------------------------------------------------------1 .RESPONSIBILITY_NAME FROM FND_RESPONSIBILITY_VL R R. child number 1 ------------------------------------SELECT R."T".100] 3 ."APPLICATION_ID"=:1 AND "B".New features in DBMS_XPLAN Peeked Binds (identified by position): -------------------------------------1 .:1 (NUMBER. Primary=1) Predicate Information (identified by operation id): --------------------------------------------------2 ."RESPONSIBILITY_ID"=:1) 4 .APPLICATION_ID = :1 <snipped out further information about child cursor 1 and 2> WHERE R.access("B".100] 4 ."T"."RESPONSIBILITY_ID"=:1 AND "T".access("T"."RESPONSIBILITY_NAME"[VARCHAR2."APPLICATION_ID"=:1 AND "T"."T".

and«.Items Learned in this Session ‡ ‡ ‡ ‡ So there you have it all! This was a summary of a few of the useful features Hopefully. the Oracle manuals! ‡ What do you plan to use when you get back to the office? . Blogs. this adds to the vast information out there Where do you go from here? ± Papers.. OTN.

com Please fill up your evaluation form! Session # 319 Oracle DB 10g: An enlightened revisit Thank you! .Questions and feedback Questions? Contact information: ora_apps_dba_y@yahoo.

Sign up to vote on this title
UsefulNot useful