13 Copyright © 2006, Oracle. All rights reserved. Tuning PGA and Temporary Space.

Slides:



Advertisements
Similar presentations
9 Copyright © 2006, Oracle. All rights reserved. Automatic Performance Management.
Advertisements

13 Copyright © 2005, Oracle. All rights reserved. Monitoring and Improving Performance.
The Architecture of Oracle
2 Copyright © 2005, Oracle. All rights reserved. Installing the Oracle Database Software.
5 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
Overview of Database Administrator (DBA) Tools
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 2 Overview of Database Administrator (DBA) Tools.
Oracle Architecture. Instances and Databases (1/2)
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Performance And Tuning – Lecture 7 Copyright System Managers LLC 2007 all rights reserved.
Page Footer Keed Education Oracle Database Administration Basic Copyright 2009 Keed Education BV Version Concept.
INTRODUCTION TO ORACLE DATABASE ADMINISTRATION Lynnwood Brown System Managers LLC Introduction – Lecture 1 Copyright System Managers LLC 2007 all rights.
13 Copyright © 2007, Oracle. All rights reserved. Performance Management.
15 Copyright © 2004, Oracle. All rights reserved. Monitoring and Managing Memory.
12 Copyright © 2005, Oracle. All rights reserved. Proactive Maintenance.
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
Harvard University Oracle Database Administration Session 5 Data Storage.
10 Copyright © 2009, Oracle. All rights reserved. Managing Undo Data.
4 Copyright © 2008, Oracle. All rights reserved. Configuring Backup Specifications.
9 Copyright © Oracle Corporation, All rights reserved. Oracle Recovery Manager Overview and Configuration.
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
1 Copyright © 2009, Oracle. All rights reserved. Exploring the Oracle Database Architecture.
Module 8: Server Management. Overview Server-level and instance-level resources such as memory and processes Database-level resources such as logical.
12 Copyright © 2004, Oracle. All rights reserved. Automatic Management.
12 Copyright © 2007, Oracle. All rights reserved. Database Maintenance.
15 Copyright © 2004, Oracle. All rights reserved. Proactive Maintenance.
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.
5 Copyright © 2004, Oracle. All rights reserved. Using Recovery Manager.
5 Copyright © 2008, Oracle. All rights reserved. Using RMAN to Create Backups.
11 Copyright © Oracle Corporation, All rights reserved. RMAN Backups.
11 Copyright © Oracle Corporation, All rights reserved. RMAN Backups.
9 Copyright © 2005, Oracle. All rights reserved. Administering User Security.
CSE 781 – DATABASE MANAGEMENT SYSTEMS Introduction To Oracle 10g Rajika Tandon.
Extents, segments and blocks in detail. Database structure Database Table spaces Segment Extent Oracle block O/S block Data file logical physical.
Oracle Tuning Ashok Kapur Hawkeye Technology, Inc.
Copyright © Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
15 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Summary.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
Outline Introduction to Oracle Memory Structures SGA, PGA, SCA The Specifics of the System Global Area (SGA) Structures Overview of Program Global Areas.
7 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
Database Storage Structures
INTRODUCTION TO ORACLE DATABASE ADMINISTRATION Lynnwood Brown President System Managers LLC Introduction – Lecture 1 Copyright System Managers LLC 2003.
Instance and Media Recovery Structures Supinfo Oracle Lab. 7.
3 Copyright © 2006, Oracle. All rights reserved. Using Recovery Manager.
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
G Copyright © 2006, Oracle. All rights reserved. Miscellaneous Topics.
2 Copyright © 2006, Oracle. All rights reserved. Configuring Recovery Manager.
Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.
8 Copyright © 2007, Oracle. All rights reserved. Using RMAN to Duplicate a Database.
3 Copyright © 2004, Oracle. All rights reserved. Creating an Oracle Database.
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
3 Copyright © 2004, Oracle. All rights reserved. Database Architecture Comparison.
13 Copyright © 2007, Oracle. All rights reserved. Using the Data Recovery Advisor.
3 Copyright © 2006, Oracle. All rights reserved. Designing and Developing for Performance.
Dr. Stephan Bühne SAP Solution Center Walldorf Oracle 9i: Features for SAP Which new Oracle 9i features are helpful for a SAP customer? Dr. Stephan Bühne.
6 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
4 Copyright © 2004, Oracle. All rights reserved. Managing the Oracle Instance.
8 Copyright © Oracle Corporation, All rights reserved. Managing Tablespaces and Data files.
5 Copyright © 2005, Oracle. All rights reserved. Managing the Oracle Instance.
Oracle Database Architectural Components
9 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
10 Copyright © 2007, Oracle. All rights reserved. Managing Undo Data.
Data, Space and Transaction Processing
Creating an Oracle Database
SQL Statement Processing
Index Index.
Database administration
Presentation transcript:

13 Copyright © 2006, Oracle. All rights reserved. Tuning PGA and Temporary Space

Copyright © 2006, Oracle. All rights reserved Objectives After completing this lesson, you should be able to do the following: Diagnose PGA memory issues Size the PGA memory Diagnose temporary space issues Specify temporary tablespace parameters for efficient operation

Copyright © 2006, Oracle. All rights reserved SQL Memory Usage Memory-intensive SQL operators: –Sort-based (sort, group-by, rollup, window,...) –Hash-join –Bitmap operators (merge and inversion) Concept of work area: –Memory allocated by a memory-intensive operator to process its input data Performance impact of memory: –Optimal: Input data fits into the work area (cache). –One-pass: Perform one extra pass over input data. –Multi-pass: Perform several extra passes over input data.

Copyright © 2006, Oracle. All rights reserved Performance Impact Response Time Memory.. 1-passoptimalM-pass Sort Response Time.. Hash-Join M 1-pass M optimal M 1-pass M optimal 1-passoptimalM-pass Memory

Copyright © 2006, Oracle. All rights reserved Automatic PGA Memory Dynamically adapts the SQL memory allocation based on: –PGA memory available –SQL operator needs –System workload Improves manageability: –No need to set *_AREA_SIZE parameters –DBA sets a memory target: PGA_AGGREGATE_TARGET Improves performance: –PGA memory is really returned to the OS. –Memory is allocated to the operation to maximize throughput. –Maximize overall memory utilization by dynamically adapting memory with workload variation. –Operation adapts its memory usage during the execution.

Copyright © 2006, Oracle. All rights reserved SQL Memory Manager HJ GB HJ WP 1 Local SMM HJ GB WP 5 Server-1 Server-n SGA Global memory bound Global SMM (CKPT) Aggregate PGA auto-target Memory Bound Computation every 3s WP 2 Local SMM WP 3 WP 4 V$SQL_WORKAREA_ACTIVE V$SQL_WORKAREA PGA Memory Usage Statistics PGA_AGGREGATE_TARGET V$PROCESS V$PROCESS_MEMORY V$PGASTAT WP 5 WP 2 WP 1 V$PGASTAT Auto-Target Computation WP 3 WP 4

Copyright © 2006, Oracle. All rights reserved Notes only page

Copyright © 2006, Oracle. All rights reserved Configuring Automatic PGA Memory PGA_AGGREGATE_TARGET : –Specifies the target aggregate amount of PGA memory available to the instance –Can be dynamically modified at the instance level –Examples: 100,000 KB; 2,500 MB; 50 GB –Default value: 10 MB or 20% of the size of the SGA, whichever is greater WORKAREA_SIZE_POLICY : –Optional –Can be dynamically modified at the instance or session level –Allows you to fall back to static SQL memory management for a particular session

Copyright © 2006, Oracle. All rights reserved Setting PGA_AGGREGATE_TARGET Initially Leave 20% of the available memory to other applications. Leave 80% of memory to the Oracle instance. For OLTP: For DSS: PGA_AGGREGATE_TARGET=(total_mem*80%)*20% PGA_AGGREGATE_TARGET=(total_mem*80%)*50%

Copyright © 2006, Oracle. All rights reserved Monitoring SQL Memory Usage V$SQL_WORKAREA_ACTIVE V$SQL_WORKAREA V$PGASTAT V$SQL_PLAN V$SQL V$SQL_WORKAREA_HISTOGRAMS V$PROCESS_MEMORY V$SYSSTAT V$TEMPSEG_USAGE

Copyright © 2006, Oracle. All rights reserved Notes only page

Copyright © 2006, Oracle. All rights reserved Monitoring SQL Memory Usage: Examples SELECT sql_text, sum(onepass_executions) onepass_cnt, sum(multipasses_executions) mpass_cnt FROM V$SQL s, V$SQL_WORKAREA wa WHERE s.address = wa.address GROUP BY sql_text HAVING sum(onepass_executions+multipasses_executions)>0; SELECT TO_NUMBER(DECODE(sid, 65535, NULL, sid)) sid, operation_type OPERATION, TRUNC(expected_size/1024) ESIZE, TRUNC(actual_mem_used/1024) MEM, TRUNC(max_mem_used/1024) MAXMEM, number_passes PASS, TRUNC(tempseg_size/1024) TSIZE FROM V$SQL_WORKAREA_ACTIVE ORDER BY 1,2; 1 2

Copyright © 2006, Oracle. All rights reserved Tuning SQL Memory Usage Determine the best PGA_AGGREGATE_TARGET value by using: – V$PGA_TARGET_ADVICE – V$PGA_TARGET_ADVICE_HISTOGRAM Monitor AWR reports/Statspack reports for: – direct path read temp – direct path write temp

Copyright © 2006, Oracle. All rights reserved PGA Target Advice Statistics V$PGA_TARGET_ADVICE predicts how cache hit percentages shown in V$PGASTAT evolve. STATISTICS_LEVEL must be set to at least TYPICAL. V$PGA_TARGET_ADVICE 13%25%50%75% 100%120%140%160%180%200%300%400% PGA_TARGET_FACTOR ESTD_PGA_CACHE_HIT_PERCENTAGE Current value Over allocation zone Good value ESTD_OVERALLOC_COUNT

Copyright © 2006, Oracle. All rights reserved PGA Target Advice Histograms V$PGA_TARGET_ADVICE_HISTOGRAM predicts how histograms shown in V$SQL_WORKAREA_HISTOGRAM evolve. STATISTICS_LEVEL must be set to at least TYPICAL.

Copyright © 2006, Oracle. All rights reserved Automatic PGA and Enterprise Manager

Copyright © 2006, Oracle. All rights reserved Automatic PGA and AWR Reports

Copyright © 2006, Oracle. All rights reserved Temporary Tablespace Management: Overview Temporary data generated by a database include: –Bitmap merges –Hash-join –Bitmap index creation –Sort –Temporary LOBs –Global temporary tables Data persists for the duration of a transaction or session. High concurrency of the space management operation is critical. Media and instance recovery is not required.

Copyright © 2006, Oracle. All rights reserved Temporary Tablespace: Best Practice Using locally managed temporary tablespace: Allows high-concurrency space management –At steady state, all space metadata is cached in SGA. –Operations are serialized by the SGA latch. Allows faster writes to temp files. Redo generated on temporary blocks is not written to disk. Makes READ ONLY databases possible

Copyright © 2006, Oracle. All rights reserved Configuring Temporary Tablespace Locally managed temporary tablespaces are uniform-extent tablespaces. 1 MB to 10 MB extent size: –For DSS, OLAP applications involving huge work areas –Large temporary LOBs are predominant. 64 KB or multiple less than 1 MB: –Small global temporary tables are predominant. –OLTP Use V$TEMPSEG_USAGE to monitor space usage and workload distribution.

Copyright © 2006, Oracle. All rights reserved Notes only page

Copyright © 2006, Oracle. All rights reserved Temporary Tablespace Group: Overview Groups multiple temporary tablespaces Characteristics: –At least one temporary tablespace –Same namespace as tablespaces –Created implicitly on first assignment –No explicit deletion Default tablespace EXAMPLE … Default temporary tablespace group TEMP Tablespace TEMP1 Tablespace TEMPn

Copyright © 2006, Oracle. All rights reserved Temporary Tablespace Group: Benefits Enables a user to use multiple temporary tablespaces: Same user in multiple sessions One particular parallel operation Temporary tablespace group TEMP Tablespace TEMP1 Tablespace TEMP2 Tablespace TEMP3 Serial Parallel HR

Copyright © 2006, Oracle. All rights reserved Creating Temporary Tablespace Groups

Copyright © 2006, Oracle. All rights reserved Maintaining Temporary Tablespace Groups

Copyright © 2006, Oracle. All rights reserved Data Dictionary Changes SELECT group_name, tablespace_name FROM DBA_TABLESPACE_GROUPS;

Copyright © 2006, Oracle. All rights reserved Monitoring Temporary Tablespace Use V$TEMPSEG_USAGE to monitor space usage and workload distribution: Use V$SORT_SEGMENT to determine space usage percentage: SELECT session_num, username, segtype, blocks, tablespace FROM V$TEMPSEG_USAGE; SELECT (s.tot_used_blocks/f.total_blocks)*100 as pctused FROM (SELECT SUM(used_blocks) tot_used_blocks FROM V$SORT_SEGMENT WHERE tablespace_name='TEMP') s, (SELECT SUM(blocks) total_blocks FROM DBA_TEMP_FILES WHERE tablespace_name='TEMP') f;

Copyright © 2006, Oracle. All rights reserved Practice Overview: Tune PGA Memory This practice covers the following topics: Enable Automatic PGA Memory Tune PGA_AGGREGATE_TARGET Tune Temporary Tablespace Performance

Copyright © 2006, Oracle. All rights reserved Summary In this lesson, you should have learned how to: Diagnose PGA memory issues Size the PGA memory Diagnose temporary space issues Specify temporary tablespace parameters for efficient operation

Copyright © 2006, Oracle. All rights reserved