John Kanagaraj DB Soft Inc Session #206 BACK PORTING ADDM, AWR, ASH AND METRICS TO ORACLE 9I & 8I.

Slides:



Advertisements
Similar presentations
DB-Time-based Oracle Performance Tuning: Theory and Practice
Advertisements

Be an Effective DBA using Oracle 10g Automatic Database Diagnostic Monitor Edward Hayrabedian Semantec Bulgaria OOD.
9 Copyright © 2006, Oracle. All rights reserved. Automatic Performance Management.
Chapter 9. Performance Management Enterprise wide endeavor Research and ascertain all performance problems – not just DBMS Five factors influence DB performance.
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Overview of performance tuning strategies Oracle Performance Tuning Allan Young June 2008.
1 Wait Event Enhancements in Oracle 10g Terry Sutton and Roger Schrag Database Specialists, Inc.
Royal London Group A group of specialist businesses where the bottom line is always financial sense Oracle Statistics – with a little bit extra on top.
13 Copyright © 2005, Oracle. All rights reserved. Performance Management.
13 Copyright © 2007, Oracle. All rights reserved. Performance Management.
John Kanagaraj DB Soft Inc Expert Session #260 Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors.
Automatic Performance Diagnosis and Tuning in Oracle 10g Graham Wood Oracle Corporation.
Oracle 10.2 for z/OS and z/Linux Performance Update.
12 Copyright © 2005, Oracle. All rights reserved. Proactive Maintenance.
The Self-managing Database: Automatic Performance Diagnosis Graham Wood Kyle Hailey Oracle Corporation Session id:
6 Copyright © 2006, Oracle. All rights reserved. Using Automatic Workload Repository.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 11 Database Performance Tuning and Query Optimization.
1 Tuning PL/SQL procedures using DBMS_PROFILER 20-August 2009 Tim Gorman Evergreen Database Technologies, Inc. Northern California Oracle.
MSF Testing Introduction Functional Testing Performance Testing.
Connect with life Praveen Srvatsa Director | AsthraSoft Consulting Microsoft Regional Director, Bangalore Microsoft MVP, ASP.NET.
CERN IT Department CH-1211 Genève 23 Switzerland t Streams new features in 11g Zbigniew Baranowski.
Average Session Load (ASL) The Golden Metric ? Kyle Hailey
Waits Defined Kyle Hailey #.2 Copyright 2006 Kyle Hailey Top 36 Foreground Waits write complete waits library cache.
It’s time to do ASH! Tuesday, Februrary 8 th 2005 Gaja Krishna Vaidyanatha Principal, DBPerfMan LLC
Module 15: Monitoring. Overview Formulate requirements and identify resources to monitor in a database environment Types of monitoring that can be carried.
Oracle Database 10g Automation Features Dallas Oracle Users Group - Oct Arun Kumar R. Cingular Wireless.
TESTING STRATEGY Requires a focus because there are many possible test areas and different types of testing available for each one of those areas. Because.
12 Copyright © 2004, Oracle. All rights reserved. Automatic Management.
Database Advisors Automatic Database Diagnostic Monitor ( ADDM )
12 Copyright © 2007, Oracle. All rights reserved. Database Maintenance.
15 Copyright © 2004, Oracle. All rights reserved. Proactive Maintenance.
® Enterprise Manager/Management Packs Conference Call Phone Number: 1(888) Pass Code: CYBER.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
#.1 Oracle Wait Interface in Oracle 10g. #.2 Today’s Session  Twelve wait event interface enhancements in Oracle 10g that we really like.  Documentation.
1 Robert Wijnbelt Health Check your Database A Performance Tuning Methodology.
Part II : Waits Events Kyle Hailey
The Self-Managing Database: Guided Application and SQL Tuning Mohamed Ziauddin Consulting Member of Technical Staff Oracle Corporation Session id:
1.
Oracle Tuning Considerations. Agenda Why Tune ? Why Tune ? Ways to Improve Performance Ways to Improve Performance Hardware Hardware Software Software.
Oracle Tuning Ashok Kapur Hawkeye Technology, Inc.
SQL Tuning made much easier with SQLTXPLAIN (SQLT) Mauro Pagano Senior Principal Technical Support Engineer Oracle Confidential – Internal/Restricted/Highly.
By Lecturer / Aisha Dawood 1.  Dedicated and Shared Server Processes  Configuring Oracle Database for Shared Server  Oracle Database Background Processes.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
Continuous DB integration testing with RAT „RATCOIN”
11 Copyright © 2004, Oracle. All rights reserved. Dealing with Database Corruption.
Power at Your Fingertips –Overlooked Gems in Oracle EM John Sheaffer Principal Sales Consultant – Oracle Corporation.
Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey
#.6 Sampling Kyle Hailey
Troubleshooting 11i issues Adam Janbolat
10G - New Manageability Features Presented by Lenka Vanek
#.1 SASH – Simulated ASH and other tools. #.2 OEMDB Optimizer Lab 128SASH performance$100,000$1500$500free SQL Tuning$100,000includedN/A Both$200,000$1500N/A.
3 Copyright © 2006, Oracle. All rights reserved. Statistics and Wait Events.
#.1 Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey
OEM 10g Performance and Tuning. #.2 Copyright 2006 Kyle Hailey Performance SQL Diagnostics SQLTuning Performance Session DB HOME.
5 Copyright © 2008, Oracle. All rights reserved. Testing and Validating a Repository.
An overview of AWR, ASH and ADDM. Learning About AWR Real-World Performance Day with Tom Kyte The Independent Oracle Users Groups presents “A Day of Real-World.
Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at
6 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
1 PVSS Oracle scalability Target = changes per second (tested with 160k) changes per client 5 nodes RAC NAS 3040, each with one.
How To Pass Oracle 1z0-060 Exam In First Attempt?
DB Issue Trouble Shooting Guideline
Performance Management
SQL Server Monitoring Overview
Performance Management
Introduction of Week 10 Assignment Discussion
One Picture is Worth a Thousand Words
How to Thrive as a DBA in an Oracle10g World
Index Index.
Wait Event Enhancements in Oracle 10g
Presentation transcript:

John Kanagaraj DB Soft Inc Session #206 BACK PORTING ADDM, AWR, ASH AND METRICS TO ORACLE 9I & 8I

Speaker Qualifications John is a Principal DB Soft Inc. Co-author of “Oracle Database 10g Insider Solutions” Executive Editor for IOUG’s SELECT Journal Technical Editors for various books Presents papers at IOUG, OAUG and OOW Published in OAUG Insight, SQL Server Magazine Oracle ACE

What this presentation is about Oracle Database 10g automates many functions Most of these (esp. for tuning/monitoring) based on features/functions that exist in earlier 8i/9i versions See how selected functions work in 10g And ‘backport’ them to 8i/9i! Examples with code where possible

What we are going to cover AWR – Automatic Workload Repository ASH – Automatic Session History ADDM – Automatic Database Diagnostic Monitor Metrics and SGA (Server Generated Alerts) Tuning Advisors How they work (brief) and how we can ‘backport’ them!

Overview of AWR Performance Data Warehouse for Oracle 10g AWR data basis for many other advisors/monitors Very similar to STATSPACK (compare/contrast) Stores snapshots of selected V$ views in WRH$ Includes Session, System, High Load SQL, Time and Wait model statistics Others such as Table/Index access count

Overview of ASH Historical View of Active Sessions Snapshots of V$SESSION and V$SESSION_WAIT Exposed via V$ACTIVE_SESSION_HISTORY Directly sampled from SGA Circular buffer in Memory Every 10 th sample ‘persisted’ in AWR tables

Overview of ADDM Starting point for diagnosing all performance issues Analyzes AWR data at the end of every snapshot Uses rules created from years of combined tuning experience (very difficult to simulate; subjective!) Reports findings and corrective actions with expected benefits for each corrective actions Uses CPU Time as a basis for comparison

Tuning Advisors Many available in Oracle 9i (Cache/MTTR/Summary) Oracle Database 10g builds on this list Redolog file sizing Advisor Tablespace Advisor Undo Advisor Segment (fragmentation/growth trend/shrinks) Advisor SQL Access Advisor SQL Tuning Advisor

Metrics and SGA Metrics record/expose rate of change for key counters EM uses these for SGA (Server Generated Alerts) Largely undocumented (Metalink Note ) See V$METRIC, V$METRIC_HISTORY, DBA_THRESHOLDS, V$ALERT_TYPES

Backporting to 9i and 8i – ASH Study existing functionality; Understand the new Compare and contrast session state information Use V$SESSION and V$SESSION_WAIT V$SESSION.WAIT_TIME is key Idea derived from V$ACTIVE_SESSION_HISTORY Basis for “Oracle Wait Interface” Code and Output in next few slides

Example 1 – Definition of ASH View -- Definition of GV$ACTIVE_SESSION_HISTORY (ASH) SELECT /*+ no_merge ordered use_nl(s,a) */ a.inst_id, s.sample_id, s.sample_time, a.session_id, a.session_serial#, a.user_id, a.sql_id, a.sql_child_number, a.sql_plan_hash_value, a.sql_opcode, a.service_hash, decode(a.session_type, 1, 'FOREGROUND', 2, 'BACKGROUND', 'UNKNOWN'), decode(a.wait_time, 0, 'WAITING', 'ON CPU'), a.qc_session_id, a.qc_instance_id, a.event, a.event_id, a.event#, a.seq#, a.p1, a.p2, a.p3, a.wait_time, a.time_waited, a.current_obj#, a.current_file#, a.current_block#, a.program, a.module, a.action, a.client_id FROM x$kewash s, x$ash a WHERE s.sample_addr = a.sample_addr and s.sample_id = a.sample_id and s.sample_time = a.sample_time;

Example 1 – Reuse Code select s.sid || ',' || s.serial# sid_serial, p.spid, s.process, s.username || '/' || s.osuser username, s.status, to_char(s.logon_time, 'DD-MON-YY HH24:MI:SS') logon_time, s.last_call_et/60 last_call_et, decode(w.wait_time,0,'(W)','(C)') || w.event || ' / ' || w.p1 || ' / ' || w.p2 || ' / ' || w.p3 waiting_event, s.machine || '/' || s.program || '/' || s.module || '/' || s.action machine_prog from v$process p, v$session s, v$session_wait w where s.paddr=p.addr and s.sid in (&List_of_Oracle_SIDs) and w.sid = s.sid order by s.logon_time;

Example 1 – Status of session Sid,Ser# OSPid ClntPr DB/OSUser Status Logon Time LastCallMn Waiting on event + p1/p2/p3 Machine/Program/Module/Action , APPS/applmgr ACTIVE 12-JAN-06 06:00:16.38 (C) db file scattered read / 124 / / 8 test3000//CSTRINVR/Concurrent Re quest// 232, SYS/oracle INACTIVE 12-JAN-06 18:55: (W) SQL*Net message from client / / (T NS V1-V3)// ON CPU (C) db file scattered read / 124 / / 8 WAITING (W) SQL*Net message from client / / Derived from definition of GV$ACTIVE_SESSION_HISTORY

Example 2 – Simulate ASH select event, seq#, p1, p2, p3, seconds_in_wait, sys.xxdba_pack.sess_sleep(1) sleep_pause from v$session_wait where sid = &&sid_to_check union all --- Build 30 of such UNION ALLs one after another! select event, seq#, p1, p2, p3, seconds_in_wait, sys.xxdba_pack.sess_sleep(1) sleep_pause from v$session_wait where sid = &&sid_to_check; union all …………. function sess_sleep (sleep_secs number) return integer is ret_val integer; Begin sys.dbms_lock.sleep(sleep_secs); ret_val := 1; return ret_val; end sess_sleep;

Example 2 – Simulate ASH 07:54:22 Please enter SID to check : 291 EVENT Seq# P1 P2 P3 SecW db file scattered read db file scattered read db file scattered read db file scattered read db file scattered read db file scattered read db file scattered read Note Event, Sequence Number, Second_In_wait and other Wait information

Backporting to 8i and 9i - ADDM ADDM reports “findings”, “recommendations” STATSPACK equivalent to AWR (almost!) ~ Top 5 % Total Event Waits Time (s) Ela Time CPU time SQL*Net message from dblink 50, db file scattered read 571, db file sequential read 181, control file parallel write 18,

Backporting to 8i and 9i – ADDM /* Get the total Time spent waiting on all events */ select sum(e.time_waited) - sum(b.time_waited) into v_tot_wt from perfstat.stats$system_event e, perfstat.stats$system_event b where b.snap_id = v_begin_id and e.snap_id = v_end_id and e.event not in (select event from perfstat.stats$idle_event); /* Get the total Time spent in the CPU */ select e.value - b.value into v_tot_cpu from perfstat.stats$sysstat b, perfstat.stats$sysstat e where b.name = e.name and b.name = 'CPU used by this session' and b.snap_id = v_begin_id and e.snap_id = v_end_id;

Backporting to 8i and 9i – ADDM cursor top_5 is select event, waits, time, pctwtt from (select event, waits, time, pctwtt from (select e.event event, e.total_waits - nvl(b.total_waits,0) waits, (e.time_waited - nvl(b.time_waited,0))/10000 time, decode(v_tot_wt + v_tot_cpu*1000, 0, 0, 100 * (e.time_waited - nvl(b.time_waited,0)) / (v_tot_wt + v_tot_cpu*1000) ) pctwtt from perfstat.stats$system_event b, perfstat.stats$system_event e where b.snap_id(+) = v_begin_id and e.snap_id = v_end_id and b.event(+) = e.event and e.total_waits > nvl(b.total_waits,0) and e.event not in (select event from perfstat.stats$idle_event) union all select 'CPU time' event, to_number(null) waits, v_tot_cpu/100 time, decode(v_tot_wt + v_tot_cpu*1000, 0, 0,100 * v_tot_cpu*1000 / (v_tot_wt + v_tot_cpu*1000)) pctwait from dual where v_tot_cpu > 0) order by time desc, waits desc ) where rownum <= 5;

Backporting to 8i and 9i – ADDM open top_5; dbms_output.put_line('Top 5 Timed Events'); dbms_output.put_line('~~~~~~~~~~~~~~~~~~'); LOOP fetch top_5 into t_event, t_waits, t_time, t_pctwtt; exit when top_5%NOTFOUND; dbms_output.put_line(t_event ||' '||to_char(t_waits, ) ||' '|| to_char(t_time, ) || ' ' || to_char(t_pctwtt*100, 90.90)); END LOOP; end;

Backporting to 8i and 9i – ADDM This is the “framework” code Invoke at the end of a STATSPACK snapshot Compare with threshold values to trigger alerts Some manual decisions (~ automatic rules in ADDM) Combine with the ASH equivalents Start small, add as you go! Trigger additional data capture when required

Backporting to 8i and 9i – Metrics Generate “in-memory” snapshots of V$ views Generate difference in values after a defined period V$SYSTEM_EVENT for System level Wait events V$SYSSTAT for System level Db statistics Compare with defined “thresholds” & raise alerts Extend to V$SESSION_EVENT and V$SESSTAT for session level metrics

Backporting to 8i and 9i – Metrics cursor sys_stat is select indx,ksusdnam, ksusgstv from x$ksusgsta where ksusgstv != 0; --- Cursor to load V$SYSSTAT cursor sys_evt is select s.indx indx, d.kslednam event, s.ksleswts total_waits, s.kslestmo total_timeouts, s.kslestim time_waited, s.kslesmxt max_wait from x$kslei s, x$ksled d where s.indx = d.indx and s.ksleswts != 0 and d.kslednam not in (select event from perfstat.stats$idle_event) order by d.indx; --- Cursor to load V$SYSTEM_EVENT type sys_stat_type is table of sys_stat%rowtype index by binary_integer; sys_stat_list sys_stat_type; type sys_evt_type is table of sys_evt%rowtype index by binary_integer; sys_evt_list sys_evt_type;

Backporting to 8i and 9i – Metrics procedure start_sys_snap is ---- Load in V$SYSSTAT values into In-memory PL/SQL table begin m_sys_start_time := sysdate; for r in sys_stat loop -- Populate PL/SQL table sys_stat_list(r.indx).ksusgstv := r.ksusgstv; end loop; for i in sys_evt loop sys_evt_list(i.indx).event := i.event; sys_evt_list(i.indx).total_waits := i.total_waits; sys_evt_list(i.indx).total_timeouts := i.total_timeouts; sys_evt_list(i.indx).time_waited := i.time_waited; sys_evt_list(i.indx).max_wait := i.max_wait; end loop; end start_sys_snap;

Backporting to 8i and 9i – Metrics procedure end_sys_snap is begin m_sys_end_time := sysdate; dbms_output.put_line('System stats - ' || to_char(m_sys_end_time,'dd-Mon hh24:mi:ss')); dbms_output.put_line('Interval:'||trunc(86400 * (m_sys_end_time - m_sys_start_time)) || 'secs'); dbms_output.put_line(rpad('Name',60) || lpad('Value',18)); dbms_output.put_line(rpad('----',60) || lpad('-----',18)); for r in sys_stat loop if (not sys_stat_list.exists(r.indx)) then sys_stat_list(r.indx).ksusgstv := 0; end if; if ((sys_stat_list(r.indx).ksusgstv != r.ksusgstv)) then dbms_output.put(rpad(r.ksusdnam,60)); dbms_output.put_line(to_char(r.ksusgstv - sys_stat_list(r.indx).ksusgstv,'9,999,999,999,990')); end if; end loop;

Backporting to 8i and 9i – Metrics 03:46:01 Please enter number of seconds between snapshots : 30 System stats - 01-Dec 03:50:21 Interval:- 31 seconds Name Value logons cumulative 34 logons current -1 user calls 4,318 recursive calls 283,055 recursive cpu usage 7,102 session logical reads 7,523,432 CPU used by this session 8,824 db block gets 254,833 consistent gets 7,270,588 physical reads 85,521 db block changes 41,170 consistent changes 18,416

Backporting to 8i and 9i - General Cannot simulate everything! Difficult to store everything! So… Script ahead for all events Tie the parts together Log to spool files Compare against ‘normal’ baselines

Items Learned in this Session Learnt about some new 10g features Saw how they worked Compared them to 8i/9i Sample Code to simulate 10g features Framework to build upon! Recognize the limits Continually being upgraded by the author

Questions?

Thank You BACK PORTING ADDM, AWR, ASH AND METRICS TO ORACLE 9I & 8I (Ses# 206) John Kanagaraj, DB Soft Inc Please complete evaluation form!