Download presentation
Presentation is loading. Please wait.
Published byMagdalen Briggs Modified over 9 years ago
1
#.1 SASH – Simulated ASH and other tools
2
#.2 OEMDB Optimizer Lab 128SASH performance$100,000$1500$500free SQL Tuning$100,000includedN/A Both$200,000$1500N/A Copyright 2006 Kyle Hailey 10 Machines with 4 processors and 1 database each 1 DBA OEM $5,000 per pack unlimited users $2,500 per pack with minimum named users
3
#.3 Copyright 2006 Kyle Hailey Simulating ASH ASH is new in 10g ASH data exist since V7 Need Diagnostic Pack License Collect it yourself SASH – Simulated ASH http://perfvision.com/sash.php Graphical Monitor http://perfvision.com/ashmon.php Consumes < 1% CPU for 10 active sessions (a lot)
4
#.4 4 Simulating ASH Performance Package License? $5000/pack/CPU ? Not on 10g ? Do it yourself V$SESSION 10g most of ASH Before 10g, join v$session and v$session_wait Sample every second Store in a table Free PL/SQL package v$active_session_history v$session SESSION_ID SID SESSION_SERIAL# SERIAL# USER_ID USER# SQL_OPCODE COMMAND PROGRAM PROGRAM SESSION_TYPE TYPE SQL_ID SQL_ID SQL_CHILD_NUMBER SQL_CHILD_NUMBER MODULE MODULE ACTION ACTION CURRENT_OBJ# ROW_WAIT_OBJ# CURRENT_FILE# ROW_WAIT_FILE# CURRENT_BLOCK# ROW_WAIT_BLOCK# CLIENT_ID CLIENT_IDENTIFIER BLOCKING_SESSION BLOCKING_SESSION BLOCKING_SESSION_STATUS BLOCKING_SESSION_STATUS SEQ# SEQ# EVENT# EVENT# EVENT EVENT P1TEXT P1TEXT P1 P1 P2TEXT P2TEXT P2 P2 P3TEXT P3TEXT P3 P3 WAIT_CLASS_ID WAIT_CLASS_ID WAIT_CLASS WAIT_CLASS WAIT_TIME WAIT_TIME
5
#.5 5 ASH extra fields v$session missing V$session extras FORCE_MATCHING_SIGNATURE v$sql.sql_id = sql_id QC_SESSION_ID QCSID v$px_session.sid=sid, serial# QC_INSTANCE_ID QCINST_ID v$px_session.sid=sid, serial# SQL_PLAN_HASH_VALUE PLAN_HASH_VALUE v$sqlstats.sql_id v$sqlstats.sql_id = sql_id (PLAN_HASH_VALUE = x$ksuse.KSUSESPH) XID v$transaction.ADDR = taddr FIXED_TABLE_SEQUENCE - find sql executions ROW_WAIT_ROW# LAST_CALL_ET - how long in current state
6
#.6 Simulating – Key Ideas session_state = decode(WAIT_TIME, 0,'WAITING', 'ON CPU') v$session where status='ACTIVE' and ON CPU : wait_time != 0 or Waiting : wait_class != 'Idle‘ select sysdate sample_time, decode(s.WAIT_TIME, 0,'WAITING','ON CPU') "SESSION_STATE" decode(s.WAIT_TIME, 0,'WAITING','ON CPU') "SESSION_STATE" /* plus other fields */ /* plus other fields */ from v$session s from v$session s where sid != ( select sid from v$mystat where rownum < 2 ) where sid != ( select sid from v$mystat where rownum < 2 ) and ( ( s.status='ACTIVE' and wait_time != 0 ) and ( ( s.status='ACTIVE' and wait_time != 0 ) or s.wait_class!='Idle' ) ; or s.wait_class!='Idle' ) ; 9i – join v$session and v$session_wait
7
#.7 Copyright 2006 Kyle Hailey Sampling Method 7,8,9i, 10g select s.username, s.sid, s.serial#, s.sql_hash_value, decode(w.wait_time, 0, w.event, 'ON CPU'), w.p1 p1, w.p2 p2, w.p3 p3 select s.username, s.sid, s.serial#, s.sql_hash_value, decode(w.wait_time, 0, w.event, 'ON CPU'), w.p1, w.p2, w.p3 select s.username, s.sid, s.serial#, s.sql_hash_value, decode(w.wait_time, 0, w.event, 'ON CPU'), w.p1, w.p2, w.p3 from v$session s, v$session_wait w where w.sid=s.sid and s.status='ACTIVE' and s.type='USER' / from v$session s, v$session_wait w where w.sid=s.sid and s.status='ACTIVE' and s.type='USER' /
8
#.8 Copyright 2006 Kyle Hailey Sampling v$session10g select username, sid, serial#, sql_hash_value, decode(wait_time, 0, event, 'ON CPU'), p1,p2, p3 from v$session where status='ACTIVE' and name not in ( select event from v$event_name where wait_class='Idle' ) / select username, sid, serial#, sql_hash_value, decode(wait_time, 0, event, 'ON CPU'), p1,p2, p3 from v$session where status='ACTIVE' and name not in ( select event from v$event_name where wait_class='Idle' ) /
9
#.9 Copyright 2006 Kyle Hailey Example of Sampled Data From the above query we get output like USERNAME SID SERIAL HASH_VALUE EVENT P1 P2 P3 -------- --- ------ ---------- ----------------- -------- ------- --- SYS 64 8717 4116021597 PL/SQL lock timer 300 0 0 SYS 58 19467 961168820 ON CPU 16508152 1 0 STARGUS 71 6251 1311875676 direct path write 201 2155902 127 (CJQ0) 9 1 0 rdbms ipc message 500 0 0 Session SQL Wait USERNAME SID SERIAL HASH_VALUE EVENT P1 P2 P3 -------- --- ------ ---------- ----------------- -------- ------- --- SYS 64 8717 4116021597 PL/SQL lock timer 300 0 0 SYS 58 19467 961168820 ON CPU 16508152 1 0 STARGUS 71 6251 1311875676 direct path write 201 2155902 127 (CJQ0) 9 1 0 rdbms ipc message 500 0 0 USERNAME SID SERIAL HASH_VALUE EVENT P1 P2 P3 -------- --- ------ ---------- ----------------- -------- ------- --- SYS 64 8717 4116021597 PL/SQL lock timer 300 0 0 SYS 58 19467 961168820 ON CPU 16508152 1 0 STARGUS 71 6251 1311875676 direct path write 201 2155902 127 (CJQ0) 9 1 0 rdbms ipc message 500 0 0
10
#.10 Copyright 2006 Kyle Hailey Example of Sampled Data From the above query we get output like USERNAME SID SERIAL HASH_VALUE EVENT P1 P2 P3 -------- --- ------ ---------- ----------------- -------- ------- --- SYS 64 8717 4116021597 buffer busy wait 4 2465 220 Wait file block Type USERNAME SID SERIAL HASH_VALUE EVENT P1 P2 P3 -------- --- ------ ---------- ----------------- -------- ------- --- SYS 64 8717 4116021597 buffer busy wait 4 2465 220 USERNAME SID SERIAL HASH_VALUE EVENT P1 P2 P3 -------- --- ------ ---------- ----------------- -------- ------- --- SYS 64 8717 4116021597 buffer busy wait 4 2465 220 SQL Session
11
#.11 Copyright 2006 Kyle Hailey V1 - SASH - Simulating ASH http://perfvision.com/ash.php Install ashpack.sh (UNIX only) Automatically collects Every 3 secs v$session_wait + v$session 10g just uses v$session – faster Every Hour collects Top 20 SQL text Top 20 SQL explain plans Top 20 SQL stats Top 20 Object names (not enabled) Keeps 7 days, purges rest Needs Partitioning Option
12
#.12 Copyright 2006 Kyle Hailey SASH - Architecture # REPOSITORY REPO_SCHEMA=sash REPO_PW=sash REPO_SID=cdb REPO_HOST=cont01.perfvision.com REPO_PORT=1521 #TARGET TARG_SCHEMA=sys TARG_PW="sys as sysdba" TARG_HOST=`hostname` TARG_SID=$ORACLE_SID TARG_HOME=$ORACLE_HOME Define once And leave in script ashpack.sh
13
#.13 Copyright 2006 Kyle Hailey SASH - Architecturerepository target target target target Targets run jobs to insert data over db link ashpack.sh oracle ashpack.sh
14
#.14 Copyright 2006 Kyle Hailey SASH - Architecturerepository ASH data partitioned by DBID of Target Day of Week Makes purge fast Make queries fast
15
#.15 V2 SASH http://ashmasters.com/ash-simulation/ Installs on any platform (no longer UNIX only) Installs on Standard Edition Uses “poor mans partitioning” “v$active_session_history” is a union on SASH1-SASH7 Purging done by truncating the oldest SASH1-7 table Copyright 2006 Kyle Hailey
16
#.16 V2 SASH Repository repo_0_user.sql optional example of create the “sash” user on repository (as SYS or SYSTEM) repo_1_tables.sql install schema on repository database (run as SASH user) Monitored Database targ_1_pkg.sql install package database to be monitored (run as or sys) targ_2_jobs.sql start up collection in a job Optionally repo_2_pkg.sql Install purge procedure (on repository) repo_3_jobs.sql Run purge in job (on repository) Copyright 2006 Kyle Hailey
17
#.17 Copyright 2006 Kyle Hailey SASH - Architecturerepository target target target target Targets run jobs to insert data over db link repo_0_user.sql repo_1_tables.sql repo_2_pkg.sql repo_3_jobs.sql targ_1_pkg.sql targ_2_jobs.sql targ_1_pkg.sql targ_2_jobs.sql targ_1_pkg.sql targ_2_jobs.sql targ_1_pkg.sql targ_2_jobs.sql Oracle as SASH user Everything else as SYS or SYSTEM
18
#.18 Notes on Data Mining Now data extraction: S-ASH creates a view v$active_session_history scripts are thus compatible with 10g ASH scripts repo_4_waitgroups.sql To be fully compatible with 10g ASH scripts set up a simulated wait groups (don’t exist before 10g) repo_5_curdb.sql change the DBID in v$active_session_history view S-ASH can collect data from multiple databases To keep scripts compatible with 10g ASH scripts I define a filter on DBID in the view v$active_session_history Copyright 2006 Kyle Hailey SQL> @repo_5_curdb HOST------------------------------SFLKHAI01TORKHAI01ROMKHAI01 Enter value for host: SFLKHAI01 1 row deleted. 1 row created.
19
#.19 Copyright 2006 Kyle Hailey S-ASH – All DBs @actallsum HOST ASL GRAPH --------------- ---------- ----------------------- # of cpus ----1----2----3----4--- bsn08 1.83 +++------2- control1 1.82 ++-------2- cont01 1.28 +----- 2 bsn02.68 ++-- 4 tsukuba10.53 -- 2 limerock.13 2 bsn03.06 4 devnode.02 1 @actallsum HOST ASL GRAPH --------------- ---------- ----------------------- # of cpus ----1----2----3----4--- bsn08 1.83 +++------2- control1 1.82 ++-------2- cont01 1.28 +----- 2 bsn02.68 ++-- 4 tsukuba10.53 -- 2 limerock.13 2 bsn03.06 4 devnode.02 1
20
#.20 Copyright 2006 Kyle Hailey Simulating ASH – All DB Details @actall HOST EVENT ASL CNT ---------- ----------------------------------- ------- ---------- bsn02 local write wait.00 1 buffer busy waits.01 5 db file sequential read.01 6 log file sync.01 10 write complete waits.04 36 free buffer waits.17 135 CPU.19 153 ------------------ ------- Sum.44 bsn08 buffer busy waits.02 26 log buffer space.04 47 log file sync.04 47 enqueue.05 52 db file scattered read.10 108 rdbms ipc reply.13 134 local write wait.15 160 db file sequential read.27 281 direct path write.30 309 direct path read.32 336 CPU.38 401 ------------------ ------- Sum 1.38 @actall HOST EVENT ASL CNT ---------- ----------------------------------- ------- ---------- bsn02 local write wait.00 1 buffer busy waits.01 5 db file sequential read.01 6 log file sync.01 10 write complete waits.04 36 free buffer waits.17 135 CPU.19 153 ------------------ ------- Sum.44 bsn08 buffer busy waits.02 26 log buffer space.04 47 log file sync.04 47 enqueue.05 52 db file scattered read.10 108 rdbms ipc reply.13 134 local write wait.15 160 db file sequential read.27 281 direct path write.30 309 direct path read.32 336 CPU.38 401 ------------------ ------- Sum 1.38
21
#.21 Copyright 2006 Kyle Hailey SASH – DB Detailed AAS @act Analysis Begin Time : 2007-07-24 11:04:48 Analysis End Time : 2007-07-24 11:19:45 Start time, mins ago: 15 Request Duration : 15 Collections : 528 Data Values : 3327 Elapsed Time: 15 mins WAIT_EVENT CNT % Active Ave_Act_Sess -------------------------------------- ---------- ------------ latch free 10.3.02 log buffer space 13.39.02 buffer busy waits 14.42.03 db file scattered read 15.45.03 library cache pin 78 2.34.15 log file sync 213 6.4.4 ON CPU 726 21.82 1.38 enqueue 855 25.7 1.62 db file sequential read 1399 42.05 2.65 ------------ sum 6.3 @act Analysis Begin Time : 2007-07-24 11:04:48 Analysis End Time : 2007-07-24 11:19:45 Start time, mins ago: 15 Request Duration : 15 Collections : 528 Data Values : 3327 Elapsed Time: 15 mins WAIT_EVENT CNT % Active Ave_Act_Sess -------------------------------------- ---------- ------------ latch free 10.3.02 log buffer space 13.39.02 buffer busy waits 14.42.03 db file scattered read 15.45.03 library cache pin 78 2.34.15 log file sync 213 6.4.4 ON CPU 726 21.82 1.38 enqueue 855 25.7 1.62 db file sequential read 1399 42.05 2.65 ------------ sum 6.3
22
#.22 Copyright 2006 Kyle Hailey SASH – AAS over time @aveact TM NPTS AVEACT GRAPH CPU WAITS ---------------- ------ ------- ---------------------- ---- ----- 06-AUG 13:00:00 270.33 +- 2 29 59 06-AUG 14:00:00 1040 2.24 ++--------2--- 341 1984 06-AUG 15:00:00 623 6.67 ++++------2---------- 438 3718 06-AUG 16:00:00 1088 2.59 ++--------2---- 335 2486 06-AUG 17:00:00 1104 1.26 ++----- 2 349 1043 06-AUG 18:00:00 1093 1.38 +++---- 2 663 842 06-AUG 19:00:00 1012 1.74 ++------- 2 373 1388 06-AUG 20:00:00 1131.99 +---- 2 304 820 06-AUG 21:00:00 1111 1.22 ++----- 2 344 1012 06-AUG 22:00:00 1010 1.66 ++------ 2 414 1259 06-AUG 23:00:00 1120 1.08 +---- 2 298 913 07-AUG 00:00:00 1024.83 +--- 2 273 576 07-AUG 01:00:00 1006 1.74 ++------- 2 319 1428 07-AUG 02:00:00 1090 2.47 ++--------2---- 347 2345 07-AUG 03:00:00 687 6.59 +++-------2---------- 382 4142 07-AUG 04:00:00 1004 1.95 ++++++--- 2 1299 659 07-AUG 05:00:00 1104 3.08 +++++-----2------ 1170 2226 07-AUG 06:00:00 1122 1.91 +++++++-- 2 1582 558 07-AUG 07:00:00 1115 1.06 +++--- 2 559 618 07-AUG 08:00:00 1140.81 ++-- 2 403 519 07-AUG 09:00:00 1128.88 ++--- 2 386 601 @aveact TM NPTS AVEACT GRAPH CPU WAITS ---------------- ------ ------- ---------------------- ---- ----- 06-AUG 13:00:00 270.33 +- 2 29 59 06-AUG 14:00:00 1040 2.24 ++--------2--- 341 1984 06-AUG 15:00:00 623 6.67 ++++------2---------- 438 3718 06-AUG 16:00:00 1088 2.59 ++--------2---- 335 2486 06-AUG 17:00:00 1104 1.26 ++----- 2 349 1043 06-AUG 18:00:00 1093 1.38 +++---- 2 663 842 06-AUG 19:00:00 1012 1.74 ++------- 2 373 1388 06-AUG 20:00:00 1131.99 +---- 2 304 820 06-AUG 21:00:00 1111 1.22 ++----- 2 344 1012 06-AUG 22:00:00 1010 1.66 ++------ 2 414 1259 06-AUG 23:00:00 1120 1.08 +---- 2 298 913 07-AUG 00:00:00 1024.83 +--- 2 273 576 07-AUG 01:00:00 1006 1.74 ++------- 2 319 1428 07-AUG 02:00:00 1090 2.47 ++--------2---- 347 2345 07-AUG 03:00:00 687 6.59 +++-------2---------- 382 4142 07-AUG 04:00:00 1004 1.95 ++++++--- 2 1299 659 07-AUG 05:00:00 1104 3.08 +++++-----2------ 1170 2226 07-AUG 06:00:00 1122 1.91 +++++++-- 2 1582 558 07-AUG 07:00:00 1115 1.06 +++--- 2 559 618 07-AUG 08:00:00 1140.81 ++-- 2 403 519 07-AUG 09:00:00 1128.88 ++--- 2 386 601
23
#.23 Copyright 2006 Kyle Hailey SASH – AAS over time with waits @aveactn TO_CHAR(STA AAS AAS1 FIRST AAS2 SECOND GRAPH ----------- ------- ----- --------------- ----- --------------- ------------------------ 06 13:00:00.30.11 db file sequent.10 CPU - 2 06 14:00:00 2.24.87 direct path wri.49 log file sync ++--------2--- 06 15:00:00 6.67 2.07 direct path wri 1.93 log file sync ++++------2---------- 06 16:00:00 2.59 1.01 direct path wri.57 log file sync ++--------2---- 06 17:00:00 1.26.63 log file sync.32 CPU ++----- 2 06 18:00:00 1.38.61 CPU.45 log file sync +++---- 2 06 19:00:00 1.86.97 log file sync.39 CPU ++------- 2 06 20:00:00.99.38 log file sync.27 CPU +---- 2 06 21:00:00 1.22.57 log file sync.31 CPU ++----- 2 06 22:00:00 1.66.81 log file sync.41 CPU ++------ 2 06 23:00:00 1.08.49 log file sync.27 CPU +---- 2 07 00:00:00.83.37 log file sync.27 CPU +--- 2 07 01:00:00 1.74.96 log file sync.31 CPU ++------- 2 07 02:00:00 2.48 1.21 direct path wri.52 log file sync ++--------2---- 07 03:00:00 6.59 2.63 direct path wri 1.58 log file sync +++-------2---------- 07 04:00:00 1.95 1.29 CPU.27 log file sync ++++++--- 2 07 05:00:00 3.08 1.05 CPU.83 enqueue +++++-----2------ @aveactn TO_CHAR(STA AAS AAS1 FIRST AAS2 SECOND GRAPH ----------- ------- ----- --------------- ----- --------------- ------------------------ 06 13:00:00.30.11 db file sequent.10 CPU - 2 06 14:00:00 2.24.87 direct path wri.49 log file sync ++--------2--- 06 15:00:00 6.67 2.07 direct path wri 1.93 log file sync ++++------2---------- 06 16:00:00 2.59 1.01 direct path wri.57 log file sync ++--------2---- 06 17:00:00 1.26.63 log file sync.32 CPU ++----- 2 06 18:00:00 1.38.61 CPU.45 log file sync +++---- 2 06 19:00:00 1.86.97 log file sync.39 CPU ++------- 2 06 20:00:00.99.38 log file sync.27 CPU +---- 2 06 21:00:00 1.22.57 log file sync.31 CPU ++----- 2 06 22:00:00 1.66.81 log file sync.41 CPU ++------ 2 06 23:00:00 1.08.49 log file sync.27 CPU +---- 2 07 00:00:00.83.37 log file sync.27 CPU +--- 2 07 01:00:00 1.74.96 log file sync.31 CPU ++------- 2 07 02:00:00 2.48 1.21 direct path wri.52 log file sync ++--------2---- 07 03:00:00 6.59 2.63 direct path wri 1.58 log file sync +++-------2---------- 07 04:00:00 1.95 1.29 CPU.27 log file sync ++++++--- 2 07 05:00:00 3.08 1.05 CPU.83 enqueue +++++-----2------
24
#.24 Copyright 2006 Kyle Hailey Aveact.sql
25
#.25 Copyright 2006 Kyle Hailey “-” = WAIT “+” = CPU which waits ? -> aveactn.sql
26
#.26 Aveactn.sql Copyright 2006 Kyle Hailey
27
#.27 Copyright 2006 Kyle Hailey SASH – SQL longest running @ @longsql.sql START_TIME COUNT(*) SQL_ID FIXED_TABLE_SEQUENCE TOPN ------------ ---------- ---------- -------------------- ---------- JUN-01 02:00 29 795857215 34254 1 JUN-01 02:00 29 795857215 34547 1 JUN-01 02:00 29 986013188 34305 1 JUN-01 02:15 105 452165714 35961 1 JUN-01 02:15 102 866152581 35999 2 JUN-01 02:30 119 2586830956 39017 1 JUN-01 02:30 109 452165714 39130 2 @ @longsql.sql START_TIME COUNT(*) SQL_ID FIXED_TABLE_SEQUENCE TOPN ------------ ---------- ---------- -------------------- ---------- JUN-01 02:00 29 795857215 34254 1 JUN-01 02:00 29 795857215 34547 1 JUN-01 02:00 29 986013188 34305 1 JUN-01 02:15 105 452165714 35961 1 JUN-01 02:15 102 866152581 35999 2 JUN-01 02:30 119 2586830956 39017 1 JUN-01 02:30 109 452165714 39130 2 Using v$session fixed_table_sequence and sql_hash
28
#.28 Copyright 2006 Kyle Hailey ASHMON a free “OEM-lite” http://perfvision.com/ashmon.php Windows application Monitors Oracle 10g or 11 Show “Top Activity” page from OEM Note: Can be used on any version of Oracle with performance repository available on http://perfvision.com/sash.php
29
#.29 ASHMON 06/05/08
30
#.30 Swingbench Simulated DB activity http://www.dominicgiles.com
31
#.31 ASHMON Aggregates Drilldowns Time Slicing Guidance 31 1/15/2016
32
#.32 Copyright 2006 Kyle Hailey CPU > Max CPU
33
#.33 Copyright 2006 Kyle Hailey Radical Change in Profile
34
#.34 $5K/CPU Oracle Database = Copyright 2006 Kyle Hailey OEMASHMON DB Optimizer HSQL – local DB licensedsys/systemV$active_session_history FreesashV$active_session_history Free $1500 unlimited
35
#.35 Copyright 2006 Kyle Hailey Quest – Performance Analyzer Good interface SGA direct access only Good – fast, low impact Bad – difficult to install and administer
36
#.36 Copyright 2006 Kyle Hailey Quest
37
#.37 Copyright 2006 Kyle Hailey Quest
38
#.38 Copyright 2006 Kyle Hailey Symantec’s I3 End to End monitoring Right Data Complicated to Install and administer
39
#.39 Copyright 2006 Kyle Hailey Symantec
40
#.40 Copyright 2006 Kyle Hailey Symantec I3
41
#.41 Copyright 2006 Kyle Hailey Symantec I3
42
#.42 Copyright 2006 Kyle Hailey Lab 128 Easy Fast Cheap Great data analysis Collects right information Complicated interface - “Geeks tool” No Analysis
43
#.43 Copyright 2006 Kyle Hailey Confio’s Ignite
44
#.44 DB Optimizer Copyright 2006 Kyle Hailey
45
#.45 Copyright 2006 Kyle Hailey Lab128
46
#.46 Copyright 2006 Kyle Hailey Summary Tools Tools Quest Performance Analyst Confio’s Ignite Symantec’s I3 Lab128 DB Optimizer Free but no graphics SASH Your custom queries Simulated ASH
47
#.47 OEMDB Optimizer Lab 128SASH performance$100,000$1500$500free SQL Tuning$100,000includedN/A Both$200,000$1500N/A Copyright 2006 Kyle Hailey 10 Machines with 4 processors and 1 database each 1 DBA OEM $5,000 per pack unlimited users $2,500 per pack with minimum named users
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.