Oracle 10g Performance: chapter 01 ash

657 views
517 views

Published on

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
657
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
64
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • Sampling is a leap in performance tuning technology. It took a clear vision of the future and a bit of a leap of faith to let go of the compulsive need to have exact measurements and instead embrace sampling a technology that statistically approximates the same value with little loss of accuracy but at the same time brings a much great wealth of information necessary for analyzing the performance of a database.
  • WAIT_TIME is time of last wait, > 0 , means on CPU TIME_WAITED is the actual wait time
  • Select session_id, session_serial# , count(*) , round((count(*)*100)/(5*60),0) "%", lpad('*',round((count(*)*10)/(5*60),0),'*') "Bar" from v$active_session_history where session_state= 'ON CPU' and SAMPLE_TIME > sysdate - (5/(24*60)) group by session_id, session_serial# order by count(*) desc /
  • Graphics – humans can process 400,000 times as much data graphically as textually Think of a map of the US and all the counties with birth rates colored from low to high. It’s a massive about of information textually but it can all be seen on one page of a map Select session_id, session_serial# , count(*) , round((count(*)*100)/(5*60),0) "%", lpad('*',round((count(*)*10)/(5*60),0),'*') "Bar" from v$active_session_history where session_state= 'ON CPU' and SAMPLE_TIME > sysdate - (5/(24*60)) group by session_id, session_serial# order by count(*) desc /
  • ASH _ash_enable = false; [ A dynamic parameter will turn off ASH sampling, flushing and the V$ views on ASH ] ADDM _addm_auto_enable = false; [ A dynamic parameter to turn off automatic ADDM runs after every AWR snapshot ] AWR "_swrf_mmon_flush" = FALSE ; AWR metrics "_swrf_mmon_metrics" = FALSE ; METRICS DB Feature Usage "_swrf_mmon_dbfus" = FALSE ; DB Feature Usage "_swrf_on_disk_enabled" = FALSE ; disable all (on disk, including manual) AWR operations:
  • set linesize 120 col entry_package for a25 col entry_procedure for a25 col cur_package for a25 col cur_procedure for a25 col calling_code for a70 select procs1.object_name || decode(procs1.procedure_name,'','','.')|| procs1.procedure_name ||' '|| decode(procs2.object_name,procs1.object_name,'',procs2.object_name) || decode(procs2.procedure_name,procs1.procedure_name,'', decode(procs2.procedure_name,'','',null,'','.')||procs2.procedure_name) "calling_code", sql_id, count(*) from v$active_session_history ash, all_procedures procs1, all_procedures procs2 where ash.PLSQL_ENTRY_OBJECT_ID = procs1.object_id (+) and ash.PLSQL_ENTRY_SUBPROGRAM_ID = procs1.SUBPROGRAM_ID (+) and ash.PLSQL_OBJECT_ID = procs2.object_id (+) and ash.PLSQL_SUBPROGRAM_ID = procs2.SUBPROGRAM_ID (+) and ash.sample_time > sysdate - &minutes/(60*24) group by procs1.object_name, procs1.procedure_name, procs2.object_name, procs2.procedure_name,sql_id order by count(*) /
  • answer a only others b - last 60 seconds only c - cumulative info since db startup d - last 10 waits only e - only wait groups, not wait events, but has the history for last hour 8 ==================================================================== Chapt 1 ASH ASH (v$active_session_history) is a revolutionary data source for monitoring and analyzing database performance. The view v$active_session_history is new in 10g, but most of the data needed in order to simulate v$active_session_history by hand has been available since which version a. 6 b. 7 c. 8 d. 9 e. 10 answer b - since version 7 when wait events were introduced along with the view v$session_wait which is the foundation for ASH 4 ==================================================================== Chapt 1 ASH How can immediate find the top IO consuming SQL statement in the last 60 seconds a. v$active_session_history b. v$sqlstats c. v$sql d. v$sqlarea answer a only others b,c,d - only have cumulative values since database startup
  • answer 4 ==================================================================== Chapt 1 ASH How can immediate find the top IO consuming SQL statement in the last 60 seconds a. v$active_session_history b. v$sqlstats c. v$sql d. v$sqlarea answer a only others b,c,d - only have cumulative values since database startup
  • Oracle 10g Performance: chapter 01 ash

    1. 1. ASH – Active Session HistoryFeel the Power Kyle Hailey http://perfvision.com #.1
    2. 2. Why should you care?Because ASH can Change your life … 10g immediately Accessible  Geeks: Via scripts in SQL  Managers : Graphical OEM Stuck on Oracle 7,8,9 ? … my apologies because 10g rocks, but … no worries, the data is accessible for you too via scripts http://perfvision.com/sash.php Copyright 2006 Kyle Hailey #.2
    3. 3. Revolution and an EvolutionOracle 6 … ie the dark ages … there was once the Cache Buffer Hit RatioOracle 7 … turned the lights on … Wait Events … hallelujah I can see the lightOracle 10g … ASH has landed(like the wheels on the suitcases) Copyright 2006 Kyle Hailey #.3
    4. 4. SamplingNew Paradigm  Clear Vision of the future  Use new sampling technology  Lets go of the need to know 100%  Statistical approximation  Cheaper  Richer Multidimensional Data  Identifies  SQL  Sessions  Objects  Machine  User Copyright 2006 Kyle Hailey #.4
    5. 5. Identify Players before ASH  Sessions v$sesstat, v$session_event # sessions x (# wait events + statistics)  Example (150 x (800+200) = 150,000 )  SQL  v$sql  Could be 10000s  Takes out latches that compete with other sql executions  Objects Also files v$filestat  V$segstat 9i+  Could be 1000s of objects Expensive ! Copyright 2006 Kyle Hailey #.5
    6. 6. ASHIntelligence for the new Millennium  Intelligently Collects Data  Samples once a second  Collects active sessions only  Collects Session/SQL/Wait  More activity, more data collected  Less activity, less data collected  Those old methods collected everything  Obfuscated the problem, too many statistics too late  Costly  Too Granular – once an hour ?! Give me a break  Collects fine grain multidimensional data Copyright 2006 Kyle Hailey #.6
    7. 7. ASH FieldsSQL> v$active_session_history Name Null? TypeSAMPLE_ID NUMBERSAMPLE_TIME TIMESTAMP(3)SESSION_ID NUMBERSESSION_SERIAL# NUMBERUSER_ID NUMBERSQL_ID VARCHAR2(13)SQL_CHILD_NUMBER NUMBERSQL_PLAN_HASH_VALUE NUMBERSQL_OPCODE NUMBERSERVICE_HASH NUMBERSESSION_TYPE VARCHAR2(10)SESSION_STATE VARCHAR2(7)QC_SESSION_ID NUMBERQC_INSTANCE_ID NUMBEREVENT VARCHAR2(64)EVENT_ID NUMBEREVENT# NUMBERSEQ# NUMBERP1 NUMBERP2 NUMBERP3 NUMBERWAIT_TIME NUMBERTIME_WAITED NUMBERCURRENT_OBJ# NUMBERCURRENT_FILE# NUMBERCURRENT_BLOCK# NUMBERPROGRAM VARCHAR2(48)MODULE VARCHAR2(48)ACTION VARCHAR2(32)CLIENT_ID Copyright 2006 Kyle Hailey VARCHAR2(64 #.7
    8. 8. v$active_session_history When SAMPLE_ID SAMPLE_TIME NUMBER TIMESTAMP(3) SESSION_ID NUMBER SESSION_SERIAL# NUMBER Session USER_ID SERVICE_HASH NUMBER NUMBER SESSION_TYPE VARCHAR2(10) PROGRAM VARCHAR2(64) MODULE VARCHAR2(48) ACTION VARCHAR2(32) CLIENT_ID VARCHAR2(64) State SESSION_STATE VARCHAR2(7) WAIT_TIME NUMBER EVENT VARCHAR2(64) EVENT_ID NUMBER EVENT# NUMBER SEQ# NUMBER Wait P1 NUMBER P2 NUMBER P3 NUMBER WAIT_TIME NUMBER TIME_WAITED NUMBER CURRENT_OBJ# NUMBER CURRENT_FILE# NUMBER CURRENT_BLOCK# NUMBER0 SQL_ID VARCHAR2(13) SQL_CHILD_NUMBER NUMBER SQL SQL_PLAN_HASH_VALUE SQL_OPCODE NUMBER NUMBER QC_SESSION_ID NUMBER QC_INSTANCE_ID NUMBER Duration TIME_WAITED Copyright 2006 Kyle Hailey NUMBER #.8
    9. 9. Primary Fields of ASH Activity : Who, What, When, HowWhen SAMPLE_TIME TimeWho SESSION_ID Session SESSION_STATE StateHow EVENT WaitWhat SQL_ID SQL Copyright 2006 Kyle Hailey #.9
    10. 10. Amazing things YOU can doTop SQL Top Consumers Top Resources SQL ID  Session • CPU Plan X  User  Object X • Waits Child#  Module.Action • Event (800*)  Program • I/O  Service • File  Client • Block  Wait • Time And Aggregated over any time Period (32 columns in ASH 10.1) Copyright 2006 Kyle Hailey #.10
    11. 11. Multi-dimensional SQL F1qcyh20550cfPackageProcedure fj6gjgsshtxyxPlan 0cjsxw5ndqdbcChild # 8t8as9usk11qw dr1rkrznhh95b W St a 10dkqv3kr8xa5 C at its 38zhkf4jdyff4 En PU ist 298wmz1kxjs1m S q: db QL TX ics db fil *Ne – 25 34 36 38 45 63 65 87 fil e s t b row Sessions e ca r e se tt a loc qu ere k/r k en d es co Program Sqlplus Toad t i a re e t n t e l r ad to nt ea c l io d ie n nt User Sys Scott System Ap pl Service ic GL OE IO at io n #.11
    12. 12. Groupings – Top ConsumerSESSION_IDSESSION_SERIAL# (identify SID reuse)SESSION_TYPE (FOREGROUND,BACKGROUND)USER_ID (SYS, SYSTEM, SCOTT etc)SERVICE_HASH (OE,GL,HR)MODULE.ACTION (PLSQL tagging)CLIENT_ID (identifying users in session pool)PROGRAM (SQL, JDBC, Forms etc)SQL_IDQC_SESSION_ID (Query Coordinator)QC_INSTANCE_ID (RAC)EVENT + P1, P2, P3CURRENT_OBJ#CURRENT_FILE#CURRENT_BLOCK# Copyright 2006 Kyle Hailey #.12
    13. 13. Top CPU SessionTop CPU consuming Session in last 5 minutes Select Select session_id, Who is the rogue session ? session_id, count(*) count(*) from from v$active_session_history v$active_session_history where where session_state= ‘ON CPU‘ and session_state= ‘ON CPU‘ and SAMPLE_TIME > sysdate – (5/(24*60)) SAMPLE_TIME > sysdate – (5/(24*60)) group by group by session_id session_id order by order by count(*) desc; count(*) desc; Copyright 2006 Kyle Hailey #.13
    14. 14. Results Top CPU Session SESSION_ID SESSION_ID COUNT(*) COUNT(*) ---------- ---------- ---------- ---------- 257 257 299 299 263 263 62 62 256 256 32 32 264 264 9 9 277 277 3 3 258 258 1 1 Copyright 2006 Kyle Hailey #.14
    15. 15. CPU with Bars SESSION_ID SESSION_ID COUNT(*) COUNT(*) % Bar % Bar ---------- ---------- ---------- ------------ ---------- ---------- ---------- ------------ 257 257 299 299 99 |**********| 99 |**********| 263 263 62 62 21 |** 21 |** || 256 256 32 32 11 |* 11 |* || 264 264 99 3 | 3 | || 277 277 33 1 | 1 | || 258 258 11 0 | 0 | || 280 280 11 0 | 0 | || Bar shows 10% increments Copyright 2006 Kyle Hailey #.15
    16. 16. Top Waiting Session Top Waiting Session in last 5 minutes Select Select session_id, session_id, count(*) count(*) from from v$active_session_history v$active_session_history where where session_state=‘WAITING’ and session_state=‘WAITING’ and SAMPLE_TIME > SYSDATE -- (5/(24*60)) SAMPLE_TIME > SYSDATE (5/(24*60)) group by group by session_id session_id order by order by count(*) desc; count(*) desc; Copyright 2006 Kyle Hailey #.16
    17. 17. Top Waiting Session Results SESSION_ID SESSION_ID COUNT(*) COUNT(*) ---------- ---------- ---------- ---------- 272 272 224 224 254 254 8 8 249 249 5 5 276 276 5 5 277 277 4 4 270 270 1 1 Copyright 2006 Kyle Hailey #.17
    18. 18. Top SQL from ASHselect select ash.SQL_ID , , ash.SQL_ID sum(decode(ash.session_state,ON CPU,1,0)) sum(decode(ash.session_state,ON CPU,1,0)) "CPU", "CPU", sum(decode(ash.session_state,WAITING,1,0)) sum(decode(ash.session_state,WAITING,1,0)) -- sum(decode(ash.session_state,WAITING, decode(en.wait_class, User I/O,1,0),0)) sum(decode(ash.session_state,WAITING, decode(en.wait_class, User I/O,1,0),0)) "WAIT" , , "WAIT" sum(decode(ash.session_state,WAITING, decode(en.wait_class, User I/O,1,0),0)) sum(decode(ash.session_state,WAITING, decode(en.wait_class, User I/O,1,0),0)) "IO" , , "IO" sum(decode(ash.session_state,ON CPU,1,1)) "TOTAL" sum(decode(ash.session_state,ON CPU,1,1)) "TOTAL"from v$active_session_history ash, from v$active_session_history ash, v$event_name en v$event_name enwhere SQL_ID is not NULL and en.event#=ash.event# where SQL_ID is not NULL and en.event#=ash.event#group by sql_id group by sql_idorder by sum(decode(session_state,ON CPU,1,1)) desc order by sum(decode(session_state,ON CPU,1,1)) desc Copyright 2006 Kyle Hailey #.18
    19. 19. Top SQL from ASH ResultsSQL_ID SQL_ID CPU CPU WAITING WAITING IO IO TOTAL TOTAL------------- ---------- ---------- ---------- ---------- ------------- ---------- ---------- ---------- ----------4c1xvq9ufwcjc 4c1xvq9ufwcjc 23386 23386 00 00 23386 233866wjw6rz5uvbp3 6wjw6rz5uvbp3 99 99 00 23 23 122 122968dm8hr9qd03 968dm8hr9qd03 97 97 00 22 22 119 119938jp5gasmrah 938jp5gasmrah 90 90 00 25 25 115 115cv8xnv81kf582 cv8xnv81kf582 42 42 00 99 51 516p9bzu19v965k 6p9bzu19v965k 21 21 00 00 21 215zu8pxnun66bu 5zu8pxnun66bu 15 15 00 00 15 15db2jr13nup72v db2jr13nup72v 99 00 00 997ks5gnj38hghv 7ks5gnj38hghv 88 00 00 88 Copyright 2006 Kyle Hailey #.19
    20. 20. Top Session select select select ash.session_id, ash.session_id, ash.session_id, ash.session_serial#, ash.session_serial#, ash.session_serial#, ash.user_id, ash.user_id, ash.user_id, ash.program, ash.program, ash.program, sum(decode(ash.session_state,ON CPU,1,0)) "CPU", sum(decode(ash.session_state,ON CPU,1,0)) "CPU", sum(decode(ash.session_state,ON CPU,1,0)) "CPU", sum(decode(ash.session_state,WAITING,1,0)) -- - sum(decode(ash.session_state,WAITING,1,0)) sum(decode(ash.session_state,WAITING,1,0)) sum(decode(ash.session_state,WAITING, sum(decode(ash.session_state,WAITING, sum(decode(ash.session_state,WAITING, decode(en.wait_class,User I/O,1, 0 ), 0)) 0))"WAITING", , , decode(en.wait_class,User I/O,1, 0 ),0 ), "WAITING" decode(en.wait_class,User I/O,1, 0)) "WAITING" sum(decode(ash.session_state,WAITING, sum(decode(ash.session_state,WAITING, sum(decode(ash.session_state,WAITING, decode(en.wait_class,User I/O,1, 0 ), 0)) 0))"IO", , , decode(en.wait_class,User I/O,1, 0 ),0 ), "IO" decode(en.wait_class,User I/O,1, 0)) "IO" sum(decode(session_state,ON CPU,1,1)) "TOTAL" sum(decode(session_state,ON CPU,1,1)) "TOTAL" sum(decode(session_state,ON CPU,1,1)) "TOTAL" from v$active_session_history ash, from v$active_session_history ash, from v$active_session_history ash, v$event_name en en v$event_name v$event_name en where en.event# = ash.event# where where en.event# = ash.event# en.event# = ash.event# group by session_id,user_id,session_serial#,program group by session_id,user_id,session_serial#,program group by session_id,user_id,session_serial#,program order by sum(decode(session_state,ON CPU,1,1)) order by sum(decode(session_state,ON CPU,1,1)) order by sum(decode(session_state,ON CPU,1,1)) Copyright 2006 Kyle Hailey #.20
    21. 21. Top Session ResultsSESSION_ID SERIAL# USER_ID PROGRAM CPU WAITING IO SESSION_ID SERIAL# USER_ID PROGRAM CPU WAITING IO---------- ------- ---------- ------------------------- ------- ---------- ---------- ---------- ------- ---------- ------------------------- ------- ---------- ---------- 247 61970 11 sqlplus 11698 00 00 247 61970 sqlplus 11698 277 11 00 oracle@labsfrh903 (LGWR) 14 21 00 277 oracle@labsfrh903 (LGWR) 14 21 276 1 0 oracle@labsfrh903 (CKPT) 19 10 0 276 1 0 oracle@labsfrh903 (CKPT) 19 10 0 278 11 00 oracle@labsfrh903 (DBW0) 29 00 00 278 oracle@labsfrh903 (DBW0) 29 280 11 00 oracle@labsfrh903 (PMON) 19 00 00 280 oracle@labsfrh903 (PMON) 19 254 22617 55 Executor.exe 13 00 33 254 22617 Executor.exe 13 255 12877 55 Executor.exe 11 00 55 255 12877 Executor.exe 11 257 33729 55 Executor.exe 15 00 11 257 33729 Executor.exe 15 255 13417 55 Executor.exe 14 00 22 255 13417 Executor.exe 14 Copyright 2006 Kyle Hailey #.21
    22. 22. Top Session w/ Usernameselect select decode(nvl(to_char(s.sid),-1),-1,DISCONNECTED,CONNECTED) decode(nvl(to_char(s.sid),-1),-1,DISCONNECTED,CONNECTED) "STATUS", "STATUS", topsession.session_id topsession.session_id "SESSION_ID", "SESSION_ID", u.name "NAME", u.name "NAME", topsession.program topsession.program "PROGRAM", "PROGRAM", max(topsession.CPU) max(topsession.CPU) "CPU", "CPU", max(topsession.WAITING) max(topsession.WAITING) "WAITING","WAITING", max(topsession.IO) max(topsession.IO) "IO", "IO", max(topsession.TOTAL) max(topsession.TOTAL) "TOTAL" "TOTAL" from ( ( {previous query} ) ) topsession, from {previous query} topsession, v$session s, v$session s, user$ uu user$ where where u.user# =topsession.user_id and u.user# =topsession.user_id and /*/* outerjoin to v$session because the session might be disconnected */*/ outer join to v$session because the session might be disconnected topsession.session_id topsession.session_id == s.sid s.sid (+) and (+) and topsession.session_serial# ==s.serial# (+) topsession.session_serial# s.serial# (+) group by topsession.session_id, topsession.session_serial#, topsession.user_id, group by topsession.session_id, topsession.session_serial#, topsession.user_id, topsession.program, s.username,s.sid,s.paddr,u.name topsession.program, s.username,s.sid,s.paddr,u.name order by max(topsession.TOTAL) desc order by max(topsession.TOTAL) desc Copyright 2006 Kyle Hailey #.22
    23. 23. Top SessionFinding a Rogue UserSTATUS SESSION_ID NAME PROGRAM CPU WAITING STATUS SESSION_ID NAME PROGRAM CPU WAITING IOIO--------------- ---------- ---------- ------------------------- ----- ---------- ---- --------------- ---------- ---------- ------------------------- ----- ---------- ----CONNECTED 247 CPU_Monger ChMgr304.exe 11704 00 00 CONNECTED 247 CPU_Monger ChMgr304.exe 11704CONNECTED 277 SYS oracle@labsfrh903 (LGWR) 14 19 00 CONNECTED 277 SYS oracle@labsfrh903 (LGWR) 14 19CONNECTED 278 SYS oracle@labsfrh903 (DBW0) 29 00 00 CONNECTED 278 SYS oracle@labsfrh903 (DBW0) 29CONNECTED 276 SYS oracle@labsfrh903 (CKPT) 18 99 00 CONNECTED 276 SYS oracle@labsfrh903 (CKPT) 18CONNECTED 280 SYS oracle@labsfrh903 (PMON) 20 00 00 CONNECTED 280 SYS oracle@labsfrh903 (PMON) 20DISCONNECTED 255 SYSTEM Executor.exe 11 44 55 DISCONNECTED 255 SYSTEM Executor.exe 11DISCONNECTED 257 SYSTEM Executor.exe 13 00 33 DISCONNECTED 257 SYSTEM Executor.exe 13DISCONNECTED 255 SYSTEM Executor.exe 14 00 22 DISCONNECTED 255 SYSTEM Executor.exe 14DISCONNECTED 257 SYSTEM Executor.exe 13 00 33 DISCONNECTED 257 SYSTEM Executor.exe 13 Copyright 2006 Kyle Hailey #.23
    24. 24. Many Ways to Attack Problems Confusing  How to Attack the problem?  Top SQL?  Top wait for that SQL?  Top Waiting Session ?  Top Waits for that Session  Top Waits for Database?  Top Session waiting for that wait  Top SQL for that wait Solution - Graphics Copyright 2006 Kyle Hailey #.24
    25. 25. Mining Data is Non Trivial Many Dimensions to consider Constantly Varying time frames Luckily 10g automates all of this functionality.  collectsall of the data  analyses all the wait events  reports on bottlenecks  supplies solutions Graphics add tremendous ease and power Copyright 2006 Kyle Hailey #.25
    26. 26. OEM Perf Page Copyright 2006 Kyle Hailey #.26
    27. 27. ASH Sampling Cheap Cost 1. With PL/SQL it’s less that 1 % CPU with 10 average active sessions 2. DMA - direct memory attach to SGA Using C code 200x Cheaper 3. ASH in 10g should be even cheaper than DMA because it’s done in the kernel Size  Circular Buffer - 1M to 128M (~2% of SGA)  Avg row around 150bytes  3600 secs in an hour  ~ ½ Meg per Active Session per hour Copyright 2006 Kyle Hailey #.27
    28. 28. How ASH works V$session_wait + v$session + extras MMON/ MMNL v$active_session_history Only writes out 1 in 10 rows via direct path inserts wrh$_active_session_history MMON - manageability monitor, AWR M000 – MMON background slave, runs snapshots MMNL - MMON lite, flushes ASH to disk Copyright 2006 Kyle Hailey #.28
    29. 29. ASH bufferSelect readsbackwards Insert point Insert one direction-No latching Touch up wait times-Index on time-No read consistency Copyright 2006 Kyle Hailey #.29
    30. 30. Family of ASH Tables Real time v$session (before 10g v$session_wait) Last 10 waits v$session_wait_history ~2 hours v$active_session_history 1 week DBA_HIST_ACTIVE_SESS_HISTORY wrh$active_session_history Copyright 2006 Kyle Hailey #.30
    31. 31. Oradebug Dump to trace file SQL> oradebug dump ashdump 5 SQL> oradebug dump ash 5 SQL> Alter session set events ‘immediate SQL> Alter session set events ‘immediate trace name ashdump level 5’; tracename ashdump level 5’; level 5 = # of minutes loader file rdbms/demo/ashldr.ctl Copyright 2006 Kyle Hailey #.31
    32. 32. INIT.ORA statistics_level = Typical (default) PARAMETER SESSION_VALUE INSTANCE_VAL ----------------------- ---------- ------------ _ash_sampling_interval 1000 1000 milliseconds _ash_size 1048618 1048618 ASH buffer size _ash_enable TRUE TRUE Turn on/off ASH sampling, flushing and the V$ views on ASH _ash_disk_write_enable TRUE TRUE Flush to disk _ash_disk_filter_ratio 10 10 write 1 in 10 points _ash_sample_all FALSE FALSE Sample including idle waits Copyright 2006 Kyle Hailey #.32
    33. 33. 10.2 ASH Extras  Blocking Session !  BLOCKING_SESSION RAC event Fixup  BLOCKING_SESSION_STATUS Plan Hash Fix up 10gR1 - during parsing no plan,  BLOCKING_SESSION_SERIAL# good way to find parsing Parameter Names problems  P1TEXT , P2TEXT, P3TEXT 10gR2 – get plan hash fixup – good but lose some ability to find Wait Grouping parsing problems  WAIT_CLASS  WAIT_CLASS_ID XID FORCE_MATCHING_SIGNATURE  Cursor sharing02/20/13 #.33 33
    34. 34. 10.2.0.3 ASH ExtrasPLSQL_ENTRY_OBJECT_IDPLSQL_ENTRY_SUBPROGRAM_IDPLSQL_OBJECT_IDPLSQL_SUBPROGRAM_ID ALL_PROCEDURES where object_id = plsql_object_id and subprogram_id = plsql_subprogram_id02/20/13 #.34 34
    35. 35. PLSQL TrackingPackage/Procedure/SQL tracking 10.2.0.3 calling_code SQL_ID COUNT(*) ----------------------------------------------- ---------- ORDERENTRY.NEWORDER 0uuqgjq7k12nf 258 ORDERENTRY.NEWCUSTOMER 0bzhqhhj9mpaa 262 ORDERENTRY.BROWSEANDUPDATEORDERS 41zu158rqf4kf 301 ORDERENTRY.NEWORDER 0yas01u2p9ch4 569 PARSE_SAME 3vjxpmhhzngu4 874 ORDERENTRY.BROWSEANDUPDATEORDERS 05s4vdwsf5802 1669 select object_name package||.|| procedure_name, sql_id, count(*) from v$active_session_history ash, all_procedures procs where ash.PLSQL_ENTRY_OBJECT_ID = procs.object_id and ash.PLSQL_ENTRY_SUBPROGRAM_ID = procs.SUBPROGRAM_ID02/20/13 #.35 35
    36. 36. 11.1g ASH extrasSQL Elapsed Operation bit vector – non timed ops SQL_EXEC_ID IN_CONNECTION_MGMT SQL_EXEC_START IN_PARSE IN_HARD_PARSESQL Row Source IN_SQL_EXECUTIONSQL_PLAN_LINE_ID IN_PLSQL_EXECUTIONSQL_PLAN_OPERATION IN_PLSQL_RPCSQL_PLAN_OPTIONS IN_PLSQL_COMPILATION IN_JAVA_EXECUTION IN_BINDWhich instance requested block? IN_CURSOR_CLOSE REMOTE_INSTANCE# ETCRecursive SQL CURRENT_ROW# EVENT#TOP_LEVEL_SQL_ID QC_SESSION_SERIAL#TOP_LEVEL_SQL_OPCODE CONSUMER_GROUP_ID FLAGS Copyright 2006 Kyle Hailey #.36
    37. 37. 11.2g ASH extrasStatisticsTM_DELTA_TIMETM_DELTA_CPU_TIMETM_DELTA_DB_TIMEDELTA_TIMEDELTA_READ_IO_REQUESTSDELTA_WRITE_IO_REQUESTSDELTA_READ_IO_BYTESDELTA_WRITE_IO_BYTESDELTA_INTERCONNECT_IO_BYTESPGA_ALLOCATEDTEMP_SPACE_ALLOCATE Copyright 2006 Kyle Hailey #.37
    38. 38. ASH Across Versions When Who SQL ASH instrumentation is exploding across the versions Waits Statistics Blocker10.1 10.2 10.2.0.3 11.1 11.2 Copyright 2006 Kyle Hailey #.38
    39. 39. How Many Active Sessions?  How much data does ASH Collect ?  1 CPU means max 1 Avg Active Session unless there is a bottleneck Big site examples:  Oracle 4 way RAC internal apps  10,000 connected, 200 active  One Site  3000 connected, 30 Active  Site  12,000 connected, 100 active Copyright 2006 Kyle Hailey #.39
    40. 40. ASH Summary  Rich & Multidimensional  Overview of system load  Drilldowns into problems  Sql  Session  Wait event  Details information on problem resolution  Sampling is the future  Took clean vision to create - Bit of a leap of faith  Less Accurate but more powerful than past  Inaccuracies unimportant for the most part  Feasible since version 7  You can implement it yourself  OEM simplifies mining of ASH data Copyright 2006 Kyle Hailey #.40
    41. 41. Q1How can you immediately find the top IO consuming SQstatement in the last 60 secondsa. v$active_session_historyb. v$sqlstats answerc. v$sql a onlyd. v$sqlarea others b,c,d - only have cumulative values since database startup Copyright 2006 Kyle Hailey #.41
    42. 42. Q2Which view can you query directly toget the specific waits that occurred30 minutes ago:a. v$active_session_historyb. v$waitclassmetricc. v$system_eventd. v$session_wait_historye. v$waitclassmetric_history a only b - last 60 seconds only c - cumulative info since db startup d - last 10 waits only e - only wait groups, not wait events, but has the history for last hour Copyright 2006 Kyle Hailey #.42
    43. 43. Q3ASH (v$active_session_history) is a revolutionary datasource for monitoring and analyzing databaseperformance. The view v$active_session_history is newin 10g, but most of the data needed in order to simulatev$active_session_history by hand has been availablesince which version b - since version 7 when wait eventsa. 6 were introduced along with the viewb. 7 v$session_waitc. 8d. 9 which is the foundation for ASHe. 10 Copyright 2006 Kyle Hailey #.43

    ×