Monitoring and Tuning Oracle for z/OS and Oracle for z/Linux.

Slides:



Advertisements
Similar presentations
Monitoring and Testing I/O
Advertisements

Office of the Accountant General (A&E) Andhra Pradesh Hyderabad
13 Copyright © 2005, Oracle. All rights reserved. Monitoring and Improving 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.
The Architecture of Oracle
IO Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Waits Covered in this Section  db file sequential read  db file scattered.
Enqueue Waits : Locks. #.2 Copyright 2006 Kyle Hailey Locks REDO Lib Cache Buffer Cache IO Locks Network.
Buffer Cache Waits. #.2 Copyright 2006 Kyle Hailey Buffer Cache Waits Waits Disk I/O Buffer Busy Library Cache Enqueue SQL*Net Free Buffer Hot Blocks.
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Performance And Tuning – Lecture 7 Copyright System Managers LLC 2007 all rights reserved.
INTRODUCTION TO ORACLE DATABASE ADMINISTRATION Lynnwood Brown System Managers LLC Introduction – Lecture 1 Copyright System Managers LLC 2007 all rights.
15 Copyright © 2004, Oracle. All rights reserved. Monitoring and Managing Memory.
Jonathan Lewis jonathanlewis.wordpress.com
Oracle 10.2 for z/OS and z/Linux Performance Update.
The Self-managing Database: Automatic Performance Diagnosis Graham Wood Kyle Hailey Oracle Corporation Session id:
Understanding Storage’s Impact on Oracle Performance Jamon Bowen Texas Memory Systems.
Agenda Overview of the optimizer How SQL is executed Identifying statements that need tuning Explain Plan Modifying the plan.
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
Oracle 10g Database Administrator: Implementation and Administration
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
1 Tuning PL/SQL procedures using DBMS_PROFILER 20-August 2009 Tim Gorman Evergreen Database Technologies, Inc. Northern California Oracle.
Module 15: Monitoring. Overview Formulate requirements and identify resources to monitor in a database environment Types of monitoring that can be carried.
Module 8: Server Management. Overview Server-level and instance-level resources such as memory and processes Database-level resources such as logical.
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Oracle on Windows Server Introduction to Oracle10g on Microsoft Windows Server.
Oracle Database Administration Lecture 6 Indexes, Optimizer, Hints.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
1 Robert Wijnbelt Health Check your Database A Performance Tuning Methodology.
Part II : Waits Events Kyle Hailey
1 Using Statspack in Oracle8i and 9i to Identify Problems Ian Jones Database Specialists, Inc.
Performance Diagnostics using STATSPACK data 18-May 2006 Tim Gorman SageLogix, Inc. N. CA Oracle Users Group.
Oracle9i Performance Tuning Chapter 1 Performance Tuning Overview.
Oracle Tuning Considerations. Agenda Why Tune ? Why Tune ? Ways to Improve Performance Ways to Improve Performance Hardware Hardware Software Software.
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
Oracle Tuning Ashok Kapur Hawkeye Technology, Inc.
13 Copyright © 2006, Oracle. All rights reserved. Tuning PGA and Temporary Space.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
15 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Summary.
Achieving Scalability, Performance and Availability on Linux with Oracle 9iR2-RAC Grant McAlister Senior Database Engineer Amazon.com Paper
1 06/05/08 Statspack Kyle Hailey
How STATSPACK Was Used to Solve Common Performance Issues Brian Hitchcock OCP 8, 8i, 9i DBA Sun Microsystems
Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
MISSION CRITICAL COMPUTING Siebel Database Considerations.
Tools for Analyzing Problems in Oracle Applications Jeff Slavitz (415)
1 Copyright © 2005, Oracle. All rights reserved. Following a Tuning Methodology.
Preface 1Performance Tuning Methodology: A Review Course Structure 1-2 Lesson Objective 1-3 Concepts 1-4 Determining the Worst Bottleneck 1-5 Understanding.
#.1 Average Active Sessions (AAS) The Golden Metric ? Kyle Hailey
Oracle9i Performance Tuning Chapter 4 Tuning the Shared Pool Memory.
8 Copyright © 2006, Oracle. All rights reserved. Tuning the Shared Pool.
Troubleshooting Dennis Shasha and Philippe Bonnet, 2013.
SQL Advanced Monitoring Using DMV, Extended Events and Service Broker Javier Villegas – DBA | MCP | MCTS.
SAP Tuning 실무 SK㈜ ERP TFT.
Oracle Database Architectural Components
Performance Tuning Methodology Approach to Attacking Oracle Performance Problems.
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.
SQL Trace and TKPROF.
DB Issue Trouble Shooting Guideline
SQL Server Monitoring Overview
Hustle and Bustle of SQL Pages
Oracle Memory Internals
Troubleshooting Techniques(*)
RAC Performance Lab.
Performance And Scalability In Oracle9i And SQL Server 2000
Presentation transcript:

Monitoring and Tuning Oracle for z/OS and Oracle for z/Linux

Thomas Niewel Oracle Deutschland GmbH

Page 3 Agenda Tuning Why ? Reasons for bad Response Time Statspack Diagnosing reasons for bad response Times SQL Tuning – TKPROF – Explain Plan WLM

Page 4 Why do we need to tune ? Users report „ bad “ response times because of – CPU Time + Wait Time – Poor performing queries – SQL-Tuning –„ bad “ Database parameters – Bottlenecks in „ System “ (Operating System, WLM, IO/Subsystem etc.)

Page 5 What can be the reasons for “ bad ” Response Time High CPU Usage High I/O Usage Memory Usage Network problems „ idle “ System Operating System (WLM, VM)

Page 6 Diagnose from the Oracle point of view Statspack A short overview

Page 7 Statspack – a short overview  spcreate.sql- installs Statspack (run only once)  statspack.snap- data capture (procedure)  spreport.sql- reporting  spdoc.txt- user documentation  sppurge.sql- delete Statspack data  spdrop.sql- drop Statspack

Page 8 Capturing data Prerequisite: timed_statistics=true Use stored procedure statspack.snap SQL> execute statspack.snap;

Page 9 Capturing data Get a baseline for future comparisons Capture snapshots – across peak load – across batch window – The time between snapshots should be <= 30 minutes Capture can be automated – Use OS utility e.g. cron – Use dbms_job – spauto.sql shipped as example

Page 10 Reporting with Statspack All data is held in an Oracle database Report between two or more snapshots – cannot report across instance startup Spreport.sql creates a report

Page 11 Reporting with Statspack DB Id DB Name Instance# Instance DB21 1 MAIL Completed Snapshots Instance DB Name SnapId Snap Started Snap Level DB21 DB Aug :00: Aug :30:28 5 Enter beginning Snap Id: 1 Enter ending Snap Id: 2 Enter name of output file [sp_1_2] :

Page 12 Analyzing a Statspack report Top down analysis Summary page – Enviroment – Load profile – Instance efficiency – Shared pool usage – Top 5 Timed Events Top SQL

Page 13 Environment section STATSPACK report for DB Name DB Id Instance Inst Num Release Cluster Host RECONPRD RECONPRD NO lin390t1 Snap Id Snap Time Sessions Curs/Sess Comment Begin Snap: 2 03-Mar-03 11:28: End Snap: Mar-03 11:58: Elapsed: (mins) Cache Sizes (end) ~~~~~~~~~~~~~~~~~ Buffer Cache: 256M Std Block Size: 16K Shared Pool Size: 48M Log Buffer: 128K

Page 14 Load profile Contains a number of common ratios Allows characterisation of the application Can point to problems – high hard parse rate – high IO rate – high login rate

Page 15 Load profile Useful if you have a comparable baseline What has changed? – txn/sec change implies changed workload – redo size/txn implies changed transaction mix – physical reads/txn implies changed SQL or plan

Page 16 Load profile Load Profile ~~~~~~~~~~~~ Per Second Per Transaction Redo size: 19, , Logical reads: 2, , Block changes: Physical reads: , Physical writes: User calls: Parses: Hard parses: Sorts: Logons: Executes: Transactions: 0.91 % Blocks changed per Read: 4.10 Recursive Call %: Rollback per transaction %: Rows per Sort:

Page 17 Instance Efficiency Gives an overview of how the instance is performing Can also be used with a comparable baseline Shared pool Statistics allow quick identification of cursor sharing problems

Page 18 Instance Efficiency Instance Efficiency Percentages (Target 100%) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Buffer Nowait %: Redo NoWait %: Buffer Hit %: In-memory Sort %: Library Hit %: Soft Parse %: Execute to Parse %: Latch Hit %: Parse CPU to Parse Elapsd %: % Non-Parse CPU: Shared Pool Statistics Begin End Memory Usage %: % SQL with executions>1: % Memory for SQL w/exec>1:

Page 19 Top 5 Timed Events CPU time – real work Shows where Oracle sessions are waiting Compare Wait Time to elapsed time % Total Wait Time shows potential benefits Use as basis for directed drilldown % Total Event Waits Time (s) Ela Time CPU time 78, enqueue 1,560,523 59, db file sequential read 1,635,253 6, db file scattered read 14,620,725 5, control file parallel write 32,816 1,396.89

Page 20 Top 5 Timed Events Sample drilldowns – CPU Time „ on CPU “ – enqueue e.g TX Enqueue – db file sequential read Index Access – db file scattered read Scan Operations control file parallel write

Page 21 Top SQL Helps to find problem statements – SQL ordered by Gets – SQL ordered by Reads – SQL ordered by Executions – SQL ordered by Parse Calls

Page 22 Top SQL CPU Elapsd Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value ,562,398 8,114 9, Module: SQL*Plus SELECT MAX(STMT_BKG_DATE_CLOSE) FROM GAH_T_STATEMENTS WHERE S TMT_ACCT_ID = :b1 AND ((:b2 = :b3 AND STMT_CARRIER != :b4 AND STMT_MSG_TYPE != :b5 AND (:b6 IS NULL OR :b6 = STMT_CARRIER ) AND ((:b8 IS NULL AND STMT_MSG_TYPE != :b9 ) OR (:b8 IS NOT NU LL AND :b8 = STMT_MSG_TYPE ))) OR (:b2 = :b13 AND STMT_CARRIER

Page 23 I/O Statistics Help to find I/O Problems – Tablespace IO Stats – File IO Stats

Page 24 I/O Statistics Tablespace Av Av Av Av Buffer Av Buf Reads Reads/s Rd(ms) Blks/Rd Writes Writes/s Waits Wt(ms) GAH_TS00_DT_MEDIUM 15,242, , , GAH_TS00_IX_ITEM 210, , GAH_TS00_IX_MEDIUM 207, , RECONPRD_TS00_TEMP 185, , GAH_TS00_IX_ITEM_REF 155, ,

Page 25 Diagnosing high CPU usage High CPU Usage High I/O utilization Memory Usage Network problems „ idle “ System Operating System (WLM, VM)

Page 26 Diagnosing high CPU usage -Operating System- Linux/390 – sar -u – iostat -x 3 – vmstat 3 – top – Etc. Z/OS – SDSF – RMF – Omegamon – etc.

Page 27 Diagnosing high CPU usage What can be the reason for „ high CPU “ Usage ? – Shared_Pool / SQL-Cache – db_file_multiblock_read_count – Buffer_Cache/ Buffer_Pool – How can Statements with a great # of buffergets be seperated ? – Statspack – SQL Script

Page 28 Diagnosing high CPU usage CPU Elapsd Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value ,494, , SELECT * FROM GAH_T_STATEMENTS WHERE STMT_ACCT_ID = :b1 AND ((:b2 = :b3 AND STMT_CARRIER != :b4 AND STMT_MSG_TYPE != :b5 AND (:b6 IS NULL OR :b6 = STMT_CARRIER ) AND ((:b8 IS NULL AND STMT_MSG_TYPE != :b9 ) OR (:b8 IS NOT NULL AND :b8 = STMT_MSG_ TYPE ))) OR (:b2 = :b13 AND STMT_CARRIER = :b14 AND STMT_MSG_T Module: SQL*Plus

Page 29 Diagnosing high CPU usage spool cpu_users.lst select buffer_gets,disk_reads,executions, ratio_to_report(buffer_gets) over () * 100 buffer_ratio, ratio_to_report(disk_reads) over () * 100 disk_ratio, sql_text from v$sqlarea order by buffer_ratio desc; spool off

Page 30 Diagnosing high CPU usage BUFFER_GETS DISK_READS EXECUTIONS BUFFER_RATIO DISK_RATIO SQL_TEXT select t.schema, t.name, t.flags, q.name from system.aq$_queue_tables t, ys.aq$_queue_table_affinities aft, system.aq$_queues q where aft.table_objno = t.objno and aft.owner_instance = :1 and q.table_objno = t.objno and q.usage = 0 and bitand(t.flags, ) = 0 for update of t.name, aft.table_objno skip locked

Page 31 SQL Tuning Check Object Statsitics – Use DBMS_STATS Analyze Execution Plan – Explain Query / V$SQL_PLAN – Optimize Query – Optimize Indexes – Index Only Access, Function Based Indexes

Page 32 Diagnose High CPU Usage High I/O utilization Memory Usage Network problems „ idle “ System Operating System (WLM, VM)

Page 33 High I/O utilization Linux/390 – sar -d – iostat -x 3 – vmstat 3 Z/OS – RMF – Omegamon etc

Page 34 High I/O utilization Disk I/O – Disk access is slower than memory access (Factor 5000 to ) – One physical disk is able to perform I/O´s per Second – Disk Reponse Times (Read operations) – 2ms (Read from disk cache) – 10ms – 15ms (Physical Reads)

Page 35 High I/O utilization Reasons for High I/O utilization – Database Cache too small (DB_CACHE_SIZE) – Sortarea too small (sort_area_size) – Hasharea too small (hash_area_size) – Too many Checkpoints – Ineffective Execution Plans (e.g. Full-Table- Scans which are not necessary)

Page 36 High I/O utilization Increase Cache Size – Reduces physical I/O Operations – Z/OS – Limited by 31 Bit Arcitecture – Multiple Adress Spaces help to improve the Memory management

Page 37 High I/O utilization Single Shared SGA Across Address Spaces AS1AS2AS3ASn An Oracle server instance has a single SGA regardless of the number of address spaces or regions configured. The user context is distributed across all AS

Page 38 High I/O utilization Linux/390 – The default maximum SGA size on Linux/390 is 750 MB without changing the base adress – the maximum SGA size to 1 GB by changing the SGA base address

Page 39 % Total Event Waits Time (s) Wt Time db file sequential read 89,086,819 11, db file scattered read 9,875, file open 505, log file sync 440, latch free 11,042, High I/O utilization Top 5 Timed Events

Page 40 Tablespace Av Av Av Av Buffer Av Buf Reads Reads/s Rd(ms) Blks/Rd Writes Writes/s Waits Wt(ms) RECEIVABLE_T_01 18,398, , ,892, SO_T_03 6,827, , , SO_I_01 5,356, , , PO_I_01 4,641, , , Tablespace I/O Stats: High I/O utilization

Page 41 D I R E C T A C C E S S D E V I C E A C T I V I T Y DEVICE AVG AVG AVG AVG AVG AVG AVG AVG % % % AVG % % STORAGE DEV DEVICE VOLUME LCU ACTIVITY RESP IOSQ DPB CUB DB PEND DISC CONN DEV DEV DEV NUMBER ANY MT GROUP NUM TYPE SERIAL RATE TIME TIME DLY DLY DLY TIME TIME TIME CONN UTIL RESV ALLOC ALLOC PEND DBORACLE LEOR00 008F DBORACLE LEOR01 008F DBORACLE LEOR02 008F DBORACLE LEOR03 008F DBORACLE LEOR04 008F DBORACLE LEOR05 008F DBORACLE LEOR06 008F DBORACLE LEOR07 008F DBORACLE LEOR08 008F DBORACLE 765A LEOR09 008F DBORACLE 765B LEOR0A 008F DBORACLE 765C LEOR0B 008F DBORACLE 765D LEOR0C 008F DBORACLE 765E LEOR0D 008F DBORACLE 765F LEOR0E 008F RMF Report ( Monitor 1; RMF Postprocessor) High I/O utilization

Page 42 RMF Report – Explanations – IOSQ TIME = UCB Queueing time – Avg Pend Time = ms, all Path´s to logical volume are busy – AVG Resp Time = Connect Time + Dicsonnect Time + Pending Time + IOSQ High I/O utilization

Page 43 SQL Tuning Check Object Statsitics – Use DBMS_STATS Analyze Execution Plan – Explain Query – Optimize Query – Optimize Indexes – Index Only Access, Function Based Indexes

Page 44 Diagnose High CPU Usage High I/O utilization Memory Usage Network problems „ idle “ System Operating System (WLM, VM)

Page 45 Memory Problems How to determine Paging/Swapping – Linux/390 – VMSTAT – Z/OS – RMF – OMEGAMON Reasons for Paging/Swapping – Too many processes/users – Database Parameters which are too generously – DB_CACHE_SIZE – HASH_SIZE – SQL_CACHE

Page 46 Diagnosing high CPU usage -Operating System- High CPU Usage High I/O utilization Memory Usage Network problems „ idle “ System Operating System (WLM, VM)

Page 47 Diagnosing Network problems Latency – LAN: < 1ms – WAN: < 10ms - 500ms – ISDN: < 50ms – VPN: ms Badwidth – Mbit (Copper) – 100 Mbit (Copper, fibre) – 1 Gbit (fibre) Great number of small packets – tcp_nodelay – SDU, TDU-Parameters (not available on z/os)

Page 48 Diagnosing high CPU usage -Operating System- High CPU Usage High I/O utilization Memory Usage Network problems „ idle “ System Operating System (WLM, VM)

Page 49 Idle System One CPU is 100% used – All other CPU´s are idle – Reason – dedicated Server – Only one process is running – Solution – Parallel Query – Not useful for OLTP Aplications – Split work - run more Processes

Page 50 Idle System Latch Contentions – Use Statspack to diagnose Enqueue Waits – Use Statspack to diagnose – Often Block Contentions because of too small initrans, Freelist, Freelist goup settings Parsing because the use of Literals – Use Statspack to diagnose – Use CURSOR SHARING – Use Bind Variables

Page 51 Idle System Top 5 Timed Events ~~~~~~~~~~~~~~~~~~ % Total Event Waits Time (s) Ela Time enqueue 1,560,523 78, CPU time 59, db file sequential read 1,635,253 6, db file scattered read 14,620,725 5, control file parallel write 32,816 1,

Page 52 Idle System Enqueue activity for DB: RECONPRD Instance: RECONPRD Snaps: > Enqueue stats gathered prior to 9i should not be compared with 9i data -> ordered by Wait Time desc, Waits desc Avg Wt Wait Eq Requests Succ Gets Failed Gets Waits Time (ms) Time (s) TX 438, , , ,471 TC 34,530 34, , ,552 PS 9,526,323 9,386, ,799 1,517, CF 42,761 42, CI 55,594 55, HW 11,356 11,

Page 53 SQL-Tuning Prerequisites – Use Cost based optimizer – DBMS_STATS (important) Explain Query – Create Plan Table: UTLXPLAN Visualize Execution Plan – UTLXPLS – UTLXPLP Note: Scripts are located in xxxxxxxx.yyyyyyyy.SQL library (z/OS) $ORACLE_HOME/rdbms/admin (Linux/Unix)

Page 54 SQL-Tuning SQL> explain plan for select a.* from scott.emp a, scott.dept b where a.deptno=b.deptno; Explained. SQL> save explain Created file explain.sql PLAN_TABLE_OUTPUT | Id | Operation | Name | Rows | Bytes | Cost | | 0 | SELECT STATEMENT | | 14 | 560 | 2 | | 1 | NESTED LOOPS | | 14 | 560 | 2 | | 2 | TABLE ACCESS FULL | EMP | 14 | 518 | 2 | |* 3 | INDEX UNIQUE SCAN | PK_DEPT | 1 | 3 | | Predicate Information (identified by operation id): PLAN_TABLE_OUTPUT access("A"."DEPTNO"="B"."DEPTNO")

Page 55 SQL-Tuning Optimizer features which help to improve execution plans – Function based indexes (very important) – SELECT * From emp where upper(ename) = ´SMITH´ – Bitmap indexes (Useful in case of Read Only) – Useful for Low Cardinality columns – Parameter: Optimizer_index_cost_adj – Optimizer access path selection can be adjusted to be more index friendly

Page 56 SQL-Tuning SQLTRACE – Prerequisite: timed_statistics=true – Activate – Alter Session set SQL_trace=true – dbms_system.set_sql_trace_in_session – Use TKPROF to show execution statistics – sys=no,explain=uid/pw

Page 57 z/OS WLM Everything works fine without peaks (e.g.CPU 30%) Common Problems we had with WLM(during peak periods) – The „Everything is important syndrom“ – User didn´t classify any discretionary goals – Everything had the same importance – Enclave(Sess) with response time goals – Enclave goes to last period (which was discretionary) shortly after Logon – No default service class for OSDI – Mistake in classification rules will result in SYSOTHER being used – discretionary goal

Page 58 Oracle for Linux /390 We had tuning work – Linux on an LPAR – Linux under VM We did not have any VM related problems The reasons for performance bottlenecks were – Execution plan of a few SQL Queries – I/O Subsystem

Page 59 Oracle for z/OS The reasons for performance bottlenecks were – WLM configuration – Execution plan of a few SQL Queries – I/O Subsystem – Variances in disc response time

Page 60 ?