![Page 1: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/1.jpg)
.......................................................................................
30052GC10
Production 1.0
September 1999
M09217
Enterprise DBA Part 2: Performance and Tuning
Slides
![Page 2: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/2.jpg)
Author
Dominique Jeunot
Technical Contributors and Reviewers
Bruce Ernst
Richard Foote
Antonio Florindo
Steven George
Joel Goodman
Scott Gossett
Lex de Haan
Donna Hamby
Scott Heisey
John Hough Jr.
Peter Kilpatrick
Kurt Lysy
Michael Moller
Howard Ostrow
Thomas Raes
Shankar Raman
S. Roo
Ulrike Schwinn
Roger Simon
Anthony Woodell
Publisher
Kelly Lee
Copyright Oracle Corporation, 1999. All rights reserved.
This documentation contains proprietary information of Oracle Corporation. It isprovided under a license agreement containing restrictions on use and disclosureand is also protected by copyright law. Reverse engineering of the software isprohibited. If this documentation is delivered to a U.S. Government Agency of theDepartment of Defense, then it is delivered with Restricted Rights and thefollowing legend is applicable:
Restricted Rights LegendUse, duplication or disclosure by the Government is subject to restrictions forcommercial computer software and shall be deemed to be Restricted Rightssoftware under Federal law, as set forth in subparagraph (c) (1) (ii) of DFARS252.227-7013, Rights in Technical Data and Computer Software (October 1988).
This material or any portion of it may not be copied in any form or by any meanswithout the express prior written permission of Oracle Corporation. Any othercopying is a violation of copyright law and may result in civil and/or criminalpenalties.
If this documentation is delivered to a U.S. Government Agency not within theDepartment of Defense, then it is delivered with “Restricted Rights,” as defined inFAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
The information in this document is subject to change without notice. If you findany problems in the documentation, please report them in writing to EducationProducts, Oracle Corporation, 500 Oracle Parkway, Box SB-6, Redwood Shores,CA 94065. Oracle Corporation does not warrant that this document is error-free.
Oracle is a registered trademark and Oracle and all Oracle products aretrademarks or registered trademarks of Oracle Corporation.
All other products or company names are used for identification purposes onlyand may be trademarks of their respective owners.
![Page 3: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/3.jpg)
1
Copyright Oracle Corporation, 1999. All rights reserved.®
Course Introduction
![Page 4: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/4.jpg)
1-2 Copyright Oracle Corporation, 1999. All rights reserved.®
Course Objectives
After completing this course, you shouldbe able to do the following:
• List the important steps for outlining a tuningmethodology
• Use Oracle tools to diagnose performanceproblems
• Configure memory resources to optimizecache operations
• Reconfigure file structures to enhanceperformance
![Page 5: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/5.jpg)
1-3 Copyright Oracle Corporation, 1999. All rights reserved.®
Course Objectives
• Identify and resolve I/O, storage, and databaseconfiguration problems
• Detect and resolve latch and lock contentionproblems
• Configure memory and disk resources tooptimize sort operations
• Diagnose and resolve performance issuesassociated with the multithreaded server
• List options to enhance performance acrossdiffering application environments
![Page 6: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/6.jpg)
2
Copyright Oracle Corporation, 1999. All rights reserved.®
Tuning Overview
![Page 7: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/7.jpg)
2-2 Copyright Oracle Corporation, 1999. All rights reserved.®
Objectives
After completing this lesson, you should be able todo the following:
• List the roles associated with the database tuningprocess
• Define the steps associated with the tuningprocess
• Identify tuning goals
![Page 8: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/8.jpg)
2-3 Copyright Oracle Corporation, 1999. All rights reserved.®
Tuning Questions
• Who tunes?
– Application designers
– Application developers
– Database administrators
– System administrators
• Why tune?
• How much tuning?
![Page 9: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/9.jpg)
2-4 Copyright Oracle Corporation, 1999. All rights reserved.®
Examples of MeasurableTuning Goals
• Response time
• Database availability
• Database hit percentages
• Memory utilization
![Page 10: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/10.jpg)
2-5 Copyright Oracle Corporation, 1999. All rights reserved.®
Tuning Goals
• Access the least number of blocks
• Cache blocks in memory
• Share application code
• Read and write data as quickly as possible
• Ensure that users do not wait for resources
• Perform backups and housekeeping whileminimizing impact
![Page 11: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/11.jpg)
2-6 Copyright Oracle Corporation, 1999. All rights reserved.®
Tuning Steps
1. Tune the design.
2. Tune the application.
3. Tune memory.
4. Tune I/O.
5. Tune contention.
6. Tune the operating system.
![Page 12: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/12.jpg)
2-7 Copyright Oracle Corporation, 1999. All rights reserved.®
Summary
In this lesson, you should have learned that it isimportant to:
• Create a good initial design
• Define roles clearly
• Perform application tuning
• Establish quantifiable goals
![Page 13: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/13.jpg)
3
Copyright Oracle Corporation, 1999. All rights reserved.®
Oracle Alert and Trace Files
![Page 14: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/14.jpg)
3-2 Copyright Oracle Corporation, 1999. All rights reserved.®
Objectives
After completing this lesson, you should be able todo the following:
• Describe the location and usefulness of the Alertlog file
• Describe the location and usefulness of thebackground and user process trace files
![Page 15: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/15.jpg)
3-3 Copyright Oracle Corporation, 1999. All rights reserved.®
Diagnostic Information
Trace files:
• Alert log file
• Background process trace files
• User trace files
![Page 16: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/16.jpg)
3-4 Copyright Oracle Corporation, 1999. All rights reserved.®
Alert Log File
• The Alert log file consists of a chronological log ofmessages and errors.
• Check the Alert log file regularly to:
– Detect internal errors (ORA-600) and blockcorruption errors
– Monitor database operations
– View the nondefault initialization parameters
• Remove or trim the Alert log file regularly afterchecking.
![Page 17: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/17.jpg)
3-5 Copyright Oracle Corporation, 1999. All rights reserved.®
Controlling the Alert Log File
Userprocess
Serverprocess
BACKGROUND_DUMP_DEST= $ORACLE_HOME/rdbms/log
Alert log file
InstanceSGA Shared pool
![Page 18: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/18.jpg)
3-6 Copyright Oracle Corporation, 1999. All rights reserved.®
Background Processes Trace Files
• The Oracle server dumps information about errorsdetected by any background process in trace files.
• Oracle support uses these trace files to diagnoseand troubleshoot problems.
![Page 19: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/19.jpg)
3-7 Copyright Oracle Corporation, 1999. All rights reserved.®
Controlling the Background ProcessesTrace Files
In the directory defined in BACKGROUND_DUMP_DEST
Instance
SGA Shared pool
DBWnSMON PMON CKPTLGWR ARCn
<SID>_smon_<PID>.trc <SID>_arc0_<PID>.trc
![Page 20: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/20.jpg)
3-8 Copyright Oracle Corporation, 1999. All rights reserved.®
User Trace Files
• Server process tracing is enabled or disabled atthe session or instance level by:
– The ALTER SESSION command
– The SET_SQL_TRACE_IN_SESSION procedure
– The initialization parameter SQL_TRACE
• A user trace file contains statistics for traced SQLstatements for that session.
• A user trace file is useful for SQL tuning.
• The Oracle database creates user trace files on aper-server-process basis.
![Page 21: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/21.jpg)
3-9 Copyright Oracle Corporation, 1999. All rights reserved.®
Controlling the User Trace Files
Userprocess
Serverprocess
In the directory defined in USER_DUMP_DESTAlert log file
InstanceSGA Shared pool
<SID>_ora_<PID>.trc
![Page 22: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/22.jpg)
3-10 Copyright Oracle Corporation, 1999. All rights reserved.®
Summary
In this lesson, you should have learned how to:
• Set, retrieve, and use the Alert log file
• Use background processes trace files
• Trace user SQL statements
![Page 23: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/23.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
44
Utilities and Dynamic PerformanceViews
![Page 24: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/24.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-2
Objectives
After completing this lesson, you should be able todo the following:
• Collect statistics through:
– Available dynamic troubleshooting andperformance views
– The UTLBSTAT/UTLESTAT report output
– Oracle wait events
– Appropriate Enterprise Manager (EM) tuningtools
• Define the latch types
• Use EM to set events for predefined situations
![Page 25: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/25.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-3
Views, Utilities, and Tools
• Dynamic troubleshooting, performance anddictionary views
– V$xxx dynamic troubleshooting andperformance views
– DBA_ xxx dictionary views
• UTLBSTAT.SQL and UTLESTAT.SQL scripts
• Oracle Wait events
• Enterprise Manager event service
• Oracle Diagnostics and Tuning packs
![Page 26: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/26.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-4
Dictionary and Special Views
Dictionary and special views provide useful statisticsafter you run the ANALYZE command:
• DBA_TABLES, DBA_TAB_COLUMNS
• DBA_CLUSTERS
• DBA_INDEXES, INDEX_STATS
• INDEX_HISTOGRAM, DBA_HISTOGRAMS
This statistics information is static until youreexecute the ANALYZE command.
![Page 27: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/27.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-5
Dynamic Troubleshooting andPerformance Views
• V$ views
– Based on X$ tables
– Listed in V$FIXED_TABLE
• X$ tables
– Not usually queried directly
– Dynamic and constantly changing
– Names abbreviated and obscure
Populated at startup and cleared at shutdown
![Page 28: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/28.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-6
Topics for Troubleshooting and Tuning
Instance/DatabaseV$DATABASE T
V$INSTANCE T
V$OPTIONTV$PARAMETER T/P V$BACKUP T
V$PX_PROCESS_SYSSTAT T/P
V$PROCESS T
V$WAITSTAT T/P
V$SYSTEM_EVENT T/P
MemoryV$BUFFER_POOL_STATISTICST/P
V$DB_OBJECT_CACHE TV$LIBRARYCACHE PV$ROWCACHE PV$SYSSTAT T/P
V$SGASTAT P
DiskV$DATAFILE T/P
V$FILESTAT T/P
V$LOG TV$LOG_HISTORY TV$DBFILE T/P
V$TEMPFILE PV$TEMPSTAT P
User/SessionV$LOCK PV$OPEN_CURSOR TV$PROCESS TV$SORT_USAGE T/P
V$SESSION T/P
V$SESSTAT T/P
V$TRANSACTION TV$SESSION_EVENT T/P
V$SESSION_WAIT T/P
V$PX_SESSTAT PV$PX_SESSION PV$SESSION_OBJECT_CACHE PContention
V$LOCK T/P
V$ROLLNAME T/P
V$ROLLSTAT T/P
V$WAITSTAT T/P
V$LATCH T/P
System-Wide Statistics Session-Related Statistics
T for TroubleshootingT/P for Troubleshooting/Performance
![Page 29: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/29.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-7
Collecting System-Wide Statistics
V$STATNAME• statistic#• name• class
V$SYSSTAT• statistic#• name• class• value
V$SGASTAT• pool• name• bytes
V$EVENT_NAME• event#• name• parameter1• parameter2• parameter3
V$SYSTEM_EVENT• event• total_waits• total_timeouts• time_waited• average_wait
![Page 30: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/30.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-8
Collecting Session-Related Statistics
V$STATNAME
• statistic#• name• class
V$SESSTAT• sid• statistic#• value
V$SESSION_WAIT• sid• seq#• event• p1/2/3text• wait_time• seconds_in_wait• state
V$SESSION• sid• serial#• username• osuser
V$SESSION_EVENT• sid• event• total_waits• total_timeouts• time_waited• average_wait• max_wait
V$EVENT_NAME• event#• name• parameter1• parameter2• parameter3
![Page 31: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/31.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-9
UTLBSTAT and UTLESTAT Scripts
• Gather performance figures over a defined period
• Produce a hard-copy report
• Use UTLBSTAT.SQL and UTLESTAT.SQL scripts
• Run the scripts from SQL*Plus connected as SYSDBA
• Set TIMED_STATISTICS to TRUE
![Page 32: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/32.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-10
Gather Statistics
utlbstat.sql
Examines the instance
Stores statistics in BEGIN tables
utlestat.sql
Examines the tablesProduces a report report.txt
Stores statistics in END tables
![Page 33: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/33.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-11
The Statistics Report
• Library cache statistics• System statistics• Wait events statistics• Latch statistics• Rollback contention statistics• Buffer Busy Wait Statistics• Dictionary cache statistics• I/O statistics per data file and tablespace• Period of measurement
![Page 34: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/34.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-12
Library Cache StatisticsSQL> Rem Select Library cache statistics.The pinhitrate should be high.
SQL> select namespace library, gets,
3> round(decode(gethits,0,1,gethits)/decode(gets,0,1,gets),3)
4> gethitratio, pins,
6> round(decode(pinhits,0,1,pinhits)/decode(pins,0,1,pins),3)
7> pinhitratio, reloads, invalidations
9> from stats$lib;
LIBRARY GETS GETHITRATI PINS PINHITRATI RELOADS INVALIDAT
-------- ---------- ---------- ---------- ---------- ---------- ----------
BODY 105 1 105 1 0 0
CLUSTER 10 1 9 1 0 0
INDEX 0 1 0 1 0 0
OBJE 0 1 0 1 0 0
PIPE 0 1 0 1 0 0
SQL AREA 2036 .987 12822 .982 95 0
TABLE/PROCED 553 .98 3714 .969 81 0
TRIGGER 917 1 917 .997 3 0
8 rows selected.
![Page 35: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/35.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-13
I/O Statistics
SQL> Rem I/O should be spread evenly accross drives. A big difference
between phys_reads and phys_blks_rd implies table scans are going on.
SQL> select table_space, file_name, phys_reads reads, phys_blks_rd
2> blks_read, phys_rd_time read_time, phys_writes writes, phys_blks_wr
3> blks_wrt, phys_wrt_tim write_time
4> from stats$files order by table_space, file_name;
TABLE_SPACE FILE_NAME READS BLKS_ READ_ WRITES BLKS_ WRITE_
READ TIME WRT TIME
------------- ----------------------- ------ --------- --------- ------ -------- ------
RBS /DATA/DISK2/rbs01.dbf 26 26 50 257 257 2411
SCOTT_DATA /DATA/scott_dat.dbf 65012 416752 38420 564 564 8860
SCOTT_INDEX /DATA/scott_ind.dbf 8 8 0 8 8 0
SYSTEM /DATA/DISK1/sys01.dbf 806 1538 1985 116 116 1721
TEMP /DATA/DISK1/temp01.dbf 168 666 483 675 675 0
USER_DATA /DATA/DISK3/user01.dbf 8 8 0 8 8 0
6 rows selected.
![Page 36: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/36.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-14
Latches: Overview
What is contention?A contention exists when multiple server processescontend for the same resources.
LRUlatch
Serverprocess
Serverprocess
Serverprocess
Serverprocess
![Page 37: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/37.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-15
Latches
Contention areas that the DBA can tune:
• Redo allocation latch
• Redo copy latch
• LRU latch
![Page 38: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/38.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-16
Latch Types
• Willing-To-Wait:
– GETS
– MISSES
– SLEEPS
• Immediate:
– IMMEDIATE GETS
– IMMEDIATE MISSES
![Page 39: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/39.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-17
Oracle Wait Events
The V$EVENT_NAME view lists a collection of Waitevents that provide information on the sessions thathad to wait to be processed:
• EVENT#
• NAME
• PARAMETER1
• PARAMETER2
• PARAMETER3
![Page 40: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/40.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-18
V$EVENT_NAME View
NAME PARAMETER1 PARAMETER2 PARAMETER3
------------------------------- ---------- ---------- ----------
PL/SQL lock timer duration
alter system set mts_dispatcher waited
buffer busy waits file# block# id
library cache pin handle addr pin address 0*mode+name
log buffer space
log file switch
(checkpoint incomplete)
transaction undo seg# wrap# count
...
136 rows selected.
SQL> SELECT name, parameter1, parameter2, parameter3
2 FROM v$event_name;
![Page 41: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/41.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-19
Statistics Event Views
• V$SYSTEM_EVENT: Total waits for an event, allsessions together
• V$SESSION_EVENT: Waits for an event for eachsession that had to wait
• V$SESSION_WAIT: Waits for an event for currentactive sessions that are waiting
![Page 42: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/42.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-20
V$SYSTEM_EVENT View
EVENT TOTAL_ TOTAL_ TIME_ AVERAGE_WAITS TIMEOUTS WAITED WAIT
----------------- ------ -------- ------ ----------latch free 5 5 5 1pmon timer 932 535 254430 272.993562process startup 3 8 2.66666667buffer busy waits 12 0 5 5...23 rows selected.
SQL> SELECT event, total_waits, total_timeouts, 2 time_waited, average_wait 3 FROM v$system_event;
![Page 43: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/43.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-21
V$SESSION_EVENT View
SID EVENT TOTAL_WAITS AVERAGE_WAIT---- ------------------------------ ----------- ------------- 10 buffer busy waits 12 5 10 db file sequential read 129 0 10 file open 1 0 10 SQL*Net message to client 77 0 10 SQL*Net more data to client 2 0 10 SQL*Net message from client 76 0
SQL> select sid, event, total_waits,average_wait 2> from v$session_event where sid=10;
![Page 44: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/44.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-22
V$SESSION_WAIT View
SID SEQ# EVENT WAIT STATETIME
---- ------ --------------------------- ----- -------1 1284 pmon timer 0 WAITING2 1697 rdbms ipc message 0 WAITING3 183 rdbms ipc message 0 WAITING4 4688 rdbms ipc message 0 WAITING5 114 smon timer 0 WAITING6 14 SQL*Net message from client -1 WAITED
SHORTTIME
SQL> SELECT sid, seq#, event, wait_time, state 2 FROM v$session_wait;
![Page 45: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/45.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-23
Oracle Management Server
Repositoryll
Server 2
Agentll
Server 1Agent
DB2DB1
Client
Console
Client
Console
Enterprise Manager (EM Version 2)
JobService
EventService
SecurityService
OMSServices
![Page 46: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/46.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-24
Event Management System
• Monitors for unusual conditions in databases,nodes, and network by creating events
• Automates problem detection by registering events
• Automates problem correction by applying fixitjobs
• Shares events and notifies administrators of eventoccurrences
• Has five predefined event test categories: Space,Fault, Resource, Performance, and AuditManagement
![Page 47: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/47.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-25
Predefined Event Tests
Fault management event tests:
• Database Alert (database)
• Database UpDown (database)
• Archiver Hung (database)
• Database Probe (database)
• Data Block Corruption (database)
• Node UpDown (node)
• Session Terminated (database)
![Page 48: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/48.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-26
Predefined Event Tests
Space management events:
• Alert File Large (database)
• Chunk Small (database)
• Disk Full (node)
• Dump Full (database)
• Fast Segment Growth (database)
• Maximum Extents (database)
• Tablespace Full (database)
![Page 49: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/49.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-27
Predefined Event Tests
Resource management events:
• Datafile Limit (database)
• Lock Limit (database)
• Process Limit (database)
• User Limit (database)
• Session Limit (database)
![Page 50: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/50.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-28
Predefined Event Tests
Performance management events:
• Buffer Cache (database)
• Chain Row (database)
• CPU Utilization (node)
• Disk I/O (node)
• In Memory Sorts (database)
• Library Cache (database)
• Rollback Contention (database)
![Page 51: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/51.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-29
Event Parameters
Parameters:
• Warning and alert thresholds
• Number of occurrences
• Focused monitoring:
– SEGMENT_OWNER
– SEGMENT_TYPE
– SEGMENT_NAME
– Any criteria related to the area
![Page 52: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/52.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-30
Fix the Problem Detected by the Event
• Manually
• Automatically by fixit jobs
![Page 53: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/53.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-31
DBA-Developed Tools
• Develop your own scripts• Use the Supplied Packages for tuning• Schedule periodic performance checking• Take advantage of the EM Job service to automate
the regular execution of these administrative tasks• Take advantage of the EM Event service to track
specific situations• Take advantage of the EM Job service to apply tasks
that automatically solve problems detected by EMevent service
![Page 54: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/54.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-32
Oracle Packs
• Oracle Diagnostics Pack:
– Performance Manager
– TopSessions
– Oracle Trace Manager
– Trace Data Viewer
– Capacity Planner
• Oracle Tuning Pack:
– Tablespace Manager
– SQL Analyze
– Oracle Expert
![Page 55: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/55.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-33
Performance ManagerPredefined scopes of statistics:
• I/O
• Contention
• Database instance
• Load
• Memory
• Top resource consumers
• Overview of performance
– Overview of cache utilization
– Overview of user activity
– Overview of throughput
– Overview of performance default chart
User-defined charts
![Page 56: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/56.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-34
TopSessions
![Page 57: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/57.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-35
TopSessions: Locks
![Page 58: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/58.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-36
Tablespace Manager
![Page 59: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/59.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-37
Common Uses of Oracle Trace Manager
• Resource-usage information collection
• Performance analysis
• Database tuning
• Application tuning
• Input to expert systems
![Page 60: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/60.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-38
Overview of Oracle Expert TuningMethodology
Specify tuning scope
Collect data
View and edit data and rules
Analyze data
Review recommendations
Implement recommendations
![Page 61: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/61.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-39
Tuning Session Scope
Four major tuning categories:
• Instance optimizations
• SQL reuse opportunities
• Appropriate space management
• Optimal data access
![Page 62: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/62.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-40
Tuning Recommendations
1. Collect the data.
2. Review the recommendations:
– Session data report
– Analysis report
3. Implement recommendations:
File Type
.ora
.txt
Type of Recommendations
Instance
Structure
![Page 63: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/63.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.4-41
Summary
In this lesson, you should have learned how to:
• Collect statistics from dictionary and dynamicperformance troubleshooting views
• Collect statistics from report.txt output ofUTLBSTAT and UTLESTAT scripts
• Define latch types
• Retrieve Oracle Wait events information
• Set alerts through EM events
• Collect statistics using the GUI tools of OracleEnterprise Manager, such as the Diagnostics Packand Tuning Pack
![Page 64: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/64.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
55
Tuning the Shared Pool
![Page 65: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/65.jpg)
5-2 Copyright Oracle Corporation, 1999. All rights reserved.
Objectives
After completing this lesson, you should be able todo the following:• Tune the library cache and the data dictionary
cache• Measure the shared pool hit ratio• Size the shared pool appropriately• Pin objects in the shared pool• Tune the shared pool reserved space• Describe the User Global Area (UGA) and session
memory considerations• Configure the large pool
![Page 66: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/66.jpg)
5-3 Copyright Oracle Corporation, 1999. All rights reserved.
The Shared Global Area
Shared pool:• Library cache• Data dictionary cache• UGA for multithreaded server connections
Databasebuffercache
Redologbuffer
Shared poolLibrary cache
Data dictionary cache
User Global Area
Largepool
![Page 67: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/67.jpg)
5-4 Copyright Oracle Corporation, 1999. All rights reserved.
The Shared Pool
• Size defined by SHARED_POOL_SIZE• Library cache contains statement text, parsed code,
and execution plan• Data dictionary cache contains table, column
definitions, and privileges from the data dictionarytables
• UGA contains MTS users’ session information
Shared pool
Librarycache
Datadictionary
cache
Shared pool
UGA
![Page 68: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/68.jpg)
5-5 Copyright Oracle Corporation, 1999. All rights reserved.
The Library Cache
• Used to store SQL statements and PL/SQL blocksto be shared by users
• Managed by an LRU algorithm
• Used to prevent statements reparsing
![Page 69: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/69.jpg)
5-6 Copyright Oracle Corporation, 1999. All rights reserved.
Shared SQL, PL/SQL areas
The Library Cache
Context areafor SELECTstatement 2
Context areafor SELECTstatement 1
SELECTstatement 1
SELECTstatement 2
SELECTstatement 1
![Page 70: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/70.jpg)
5-7 Copyright Oracle Corporation, 1999. All rights reserved.
Tuning the Library Cache
Reduce misses by keeping parsing to a minimum:
• Make sure that users can share statements
• Prevent statements from being aged out byallocating enough space
• Avoid invalidations that induce reparsing
![Page 71: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/71.jpg)
5-8 Copyright Oracle Corporation, 1999. All rights reserved.
Tuning the Library Cache
Avoid fragmentation by:
• Reserving space for large memory requirements
• Pinning frequently required large objects
• Eliminating large anonymous PL/SQL blocks
• Reducing UGA consumption of MTS connections
![Page 72: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/72.jpg)
5-9 Copyright Oracle Corporation, 1999. All rights reserved.
Terminology
• GETS: The number of lookups for objects of thenamespace
• PINS: The number of reads or executions of theobjects of the namespace
• RELOADS: The number of library cache misses onthe execution step, causing implicit reparsing ofthe statement and block
![Page 73: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/73.jpg)
5-10 Copyright Oracle Corporation, 1999. All rights reserved.
Diagnostic Toolsfor Tuning the Library Cache
V$LIBRARYCACHE Shared pool
Library cache
Shared SQL and PL/SQL
V$SQLAREA
V$SQLTEXT
V$DB_OBJECT_CACHE
report.txt
V$SGASTAT
SHARED_POOL_SIZEOPEN_CURSORSSESSION_CACHED_CURSORSCURSOR_SPACE_FOR_TIME
Data dictionarycache
UGA
![Page 74: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/74.jpg)
5-11 Copyright Oracle Corporation, 1999. All rights reserved.
Are Cursors Being Shared?
Find out which statements users are running:
SQL> select sql_text, users_executing,
2 executions, loads
3 from v$sqlarea;
SQL> select * from v$sqltext
2 where sql_text like
3 ’select * from scott.s_dept where id =%’;
SQL> select gethitratio
2 from v$librarycache
3 where namespace = ‘SQL AREA’;
Check GETHITRATIO in V$LIBRARYCACHE:
![Page 75: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/75.jpg)
5-12 Copyright Oracle Corporation, 1999. All rights reserved.
Executes PROC1—>First pin, 1 load
Executes PROC1—>Second pin, no reload
Executes PROC1—>Third pin, no reloadExecutes PROC1—>Fourth pin, no reload
Guidelines: Library Cache Reloads
Reloads should:
• Ideally be 0
• Never be more than 1% of the pins
4 pins and 0 reload
SQL> select sum(pins) "Executions", sum(reloads)
2 "Cache Misses", sum(reloads)/sum(pins)
3 from v$librarycache;
Executions Cache Misses sum(reloads)/sum(pins)
---------- ------------ ----------------------
2641 10 .00378644
![Page 76: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/76.jpg)
5-13 Copyright Oracle Corporation, 1999. All rights reserved.
If the reloads-to-pins ratio is greater than 1%,increase the SHARED_POOL_SIZE parameter.
Guidelines: Library Cache Reloads
LIBRARY GETS GETHITRATI PINS PINHITRATI
RELOADS INVALIDATI
------------ ---------- ---------- --------- ----------
--------- ----------
SQL AREA 2036 .987 12822 .982
95 0
report.txt output::
![Page 77: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/77.jpg)
5-14 Copyright Oracle Corporation, 1999. All rights reserved.
Invalidations
This column represents the number of times objectsof the namespace were marked invalid, causingreloads.
NAMESPACE PINS RELOADS INVALIDATIONS
--------------- --------- --------- -------------
SQL AREA 1797 11 4
SQL> select namespace,pins,reloads,invalidations
2 from v$librarycache;
NAMESPACE PINS RELOADS INVALIDATIONS
--------------- --------- --------- -------------
SQL AREA 1793 10 0
SQL> ANALYZE TABLE scott.s_dept COMPUTE STATISTICS;
SQL> select * from scott.s_dept;
![Page 78: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/78.jpg)
5-15 Copyright Oracle Corporation, 1999. All rights reserved.
Sizing the Library Cache
• Define the global space necessary for storedobjects (packages, views, and so on).
• Define the amount of memory used by the usualSQL statements.
• Reserve space for large memory requirements, toavoid misses and fragmentation.
• Keep frequently used objects.
• Convert large anonymous PL blocks into smallanonymous blocks that call packaged functions.
![Page 79: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/79.jpg)
5-16 Copyright Oracle Corporation, 1999. All rights reserved.
Global Space Allocation
SQL statements:
Stored objects such as packages and views:
SQL> select sum(sharable_mem) 2 from V$DB_OBJECT_CACHE;SUM(SHARABLE_MEM)----------------- 379600
SQL> select sum(sharable_mem) 2 from V$SQLAREA where executions > 5;SUM(SHARABLE_MEM)----------------- 381067
![Page 80: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/80.jpg)
5-17 Copyright Oracle Corporation, 1999. All rights reserved.
Large Memory Requirements
• Satisfy requests for large contiguous memory
• Reserve unfragmentable memory within the shared pool
Shared pool
V$SHARED_POOL_RESERVED
SHARED_POOL_SIZESHARED_POOL_RESERVED_SIZE
Library cache
Shared SQL andPL/SQL
Data dictionarycache
UGA
![Page 81: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/81.jpg)
5-18 Copyright Oracle Corporation, 1999. All rights reserved.
Tuning the Shared PoolReserved Space
Diagnostic tools for tuning:• The V$SHARED_POOL _RESERVED dictionary view• The supplied package and procedure:
– DBMS_SHARED_POOL– ABORTED_REQUEST_THRESHOLD
Guidelines: Set the SHARED_POOL_RESERVED_SIZEparameter
![Page 82: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/82.jpg)
5-19 Copyright Oracle Corporation, 1999. All rights reserved.
Keeping Large Objects
• Pin large packages in the library cache:
SQL> EXECUTE dbms_shared_pool.keep(‘ package_name’);
• Find those PL/SQL objects that are not kept in thelibrary cache:
SQL> select * from v$db_object_cache
2 where sharable_mem > 10000
3 and (type=‘PACKAGE’ or type=‘PACKAGE BODY’ or
4 type=‘FUNCTION’ or type=‘PROCEDURE’)
5 and KEPT=‘NO’;
![Page 83: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/83.jpg)
5-20 Copyright Oracle Corporation, 1999. All rights reserved.
Anonymous PL/SQL Blocks
Find the anonymous PL/SQL blocks and convertthem into small anonymous PL/SQL blocks thatcall packaged functions.
SQL> select sql_text from v$sqlarea
2 where command_type = 47
3 and length(sql_text) > 500;
![Page 84: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/84.jpg)
5-21 Copyright Oracle Corporation, 1999. All rights reserved.
Other Parameters Affecting theLibrary Cache
• OPEN_CURSORS
• CURSOR_SPACE_FOR_TIME
• SESSION_CACHED_CURSORS
![Page 85: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/85.jpg)
5-22 Copyright Oracle Corporation, 1999. All rights reserved.
The Data Dictionary Cache, Terminology,and Tuning
• Content: Definitions of dictionary objects
• Terminology:
– GETS: Number of requests on objects
– GETMISSES: Number of requests resulting incache misses
• Tuning: Avoid dictionary cache misses
![Page 86: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/86.jpg)
5-23 Copyright Oracle Corporation, 1999. All rights reserved.
Diagnostic Tools for Tuning the DataDictionary Cache
V$ROWCACHE:PARAMETER
GETS
GETMISSES
Shared pool
Data dictionarycache
report.txt
SHARED_POOL_SIZE
Library cache
Shared SQL andPL/SQL
UGA
![Page 87: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/87.jpg)
5-24 Copyright Oracle Corporation, 1999. All rights reserved.
Tuning Data Dictionary Cache
Keep the ratio of the sum of GETMISSES to the sumof GETS less than 15%:
SQL> select parameter, gets, getmisses
2 from v$rowcache;
PARAMETER GETS GETMISSES
-------------------------- --------- ---------
dc_objects 143434 171
dc_synonyms 140432 127
![Page 88: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/88.jpg)
5-25 Copyright Oracle Corporation, 1999. All rights reserved.
If there are too many cache misses, increase theparameter SHARED_POOL_SIZE.
Guidelines: Dictionary Cache Misses
NAME GET_REQS GET_MISS
--------------- -------- --------
dc_objects 143434 171
dc_synonyms 140432 127
report.txt output:
![Page 89: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/89.jpg)
5-26 Copyright Oracle Corporation, 1999. All rights reserved.
UGA and MTS
Shared pool Stackspace
Usersession
data Cursor
state
Stack space
PGA
Dedicated server connection:
Multithreaded server connection:
Shared pool Usersession
data Cursor
state
PGA
UGA
UGA
V$STATNAME
V$SESSTAT
V$MYSTAT
OPEN_CURSORSSESSION_CACHED_CURSORS
![Page 90: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/90.jpg)
5-27 Copyright Oracle Corporation, 1999. All rights reserved.
Sizing the User Global Area
SQL> select SUM(value) ||’bytes’ "Total session memory" 2 from V$SESSTAT, V$STATNAME
3 where name = ’session uga memory’ 4 and v$sesstat.statistic# = v$statname.statistic#;
UGA space used by your test connection:
SQL> select SUM(value) ||’bytes’ "Total session memory" 2 from V$MYSTAT, V$STATNAME
3 where name = ’session uga memory’ 4 and v$mystat.statistic# = v$statname.statistic#;
SQL> select SUM(value) ||’bytes’ "Total max memory" 2 from V$SESSTAT, V$STATNAME
3 where name = ’session uga memory max’ 4 and v$sesstat.statistic# = v$statname.statistic#;
UGA space used by all MTS users:
Maximum UGA space used by all MTS users:
![Page 91: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/91.jpg)
5-28 Copyright Oracle Corporation, 1999. All rights reserved.
Large Pool
• Can be configured as a separate memory area in theSGA, used for memory with:
– I/O server processes: DBWR_IO_SLAVES
– Oracle backup and restore operations
– Session memory for the multithreaded servers
– Parallel query messaging
• Is useful in these situations to avoid performanceoverhead caused by shrinking the shared SQL cache
• Is sized by the LARGE_POOL_SIZE parameter
Databasebuffer cache
Redo log buffer Shared pool
Library cache
Data dictionary cache
User Global Area
Large pool
![Page 92: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/92.jpg)
5-29 Copyright Oracle Corporation, 1999. All rights reserved.
Summary
In this lesson, you should have learned about:
• The shared pool, which is made up of:
– The shared SQL and PL/SQL areas (librarycache)
– The data dictionary cache or row cache
– The User Global Area, if connections aremultithreaded server connections, unless thelarge pool is configured
• Tuning the library cache
• Configuring the large pool
![Page 93: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/93.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
66Tuning the Buffer Cache
![Page 94: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/94.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-2
Objectives
After completing this lesson, you should be able todo the following:• Describe how the buffer cache is managed• Calculate and tune the buffer cache hit ratio• Tune the buffer cache hit ratio by adding or
removing buffers• Create multiple buffer pools• Size multiple pools• Monitor buffer cache usage• Make appropriate use of table caching• Diagnose LRU latch contention• Avoid free list contention
![Page 95: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/95.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-3
Overview
SGA DB buffer cache
Dirtylist
.
.
.
.
LRUlist
.
.
.
.
DBWn
Server
• DB_BLOCK_SIZE * DB_BLOCK_BUFFERS• Server reads into the buffer cache• DBWn writes from the buffer cache• Read-consistent copies• Free, dirty, or pinned state
Datafiles
Data files
![Page 96: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/96.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-4
Managing the Data Buffer Cache
SGA DB buffer cache1
2
Dirtylist
.
.
.
.
LRUlist
.
.
.
.
DBWn
3
4
5
5Server
LGWRDatafiles
Data files
![Page 97: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/97.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-5
Managing the Data Buffer Cache
SGA DB buffer cache
Dirtylist
.
.
.
.
LRUlist
.
.
.
.
DBWn
6
Server
7
7 LGWRDatafiles
8
9
10
Data files
![Page 98: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/98.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-6
Tuning Goals and Techniques
• Tuning goals:
– Servers find data in memory
– 90% hit ratio for OLTP
• Tuning techniques:
– Increase buffer cache size
– Use multiple buffer pools
– Cache tables
– Bypass the buffer cache for sorting and parallelreads
![Page 99: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/99.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-7
V$SYSSTAT
report.txt
Diagnostic Tools
V$SESSTAT
SGA
LRU list
Dirty list
DB buffer cache
Keep buffer pool
Recycle buffer pool
Default buffer pool
V$BUFFER_POOL
DB_BLOCK_SIZEDB_BLOCK_BUFFERSDB_BLOCK_LRU_LATCHESBUFFER_POOL_KEEPBUFFER_POOL_RECYCLE
V$SYSTEM_EVENT
V$BH
V$SESSION_WAIT
V$CACHE
V$BUFFER_POOL_STATISTICS
![Page 100: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/100.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-8
Measuring the Cache Hit Ratio
SQL> SELECT 1 - (phy.value / (cur.value + con.value)) 2 "CACHE HIT RATIO" 3 FROM v$sysstat cur, v$sysstat con, v$sysstat phy 6 WHERE cur.name = ’db block gets’ 7 AND con.name = ’consistent gets’ 8 AND phy.name = ’physical reads’;
CACHE HIT RATIO--------------- .908160337
Statistic Total Per Transact Per Logon Per Second--------------- ------ ------------ --------- ----------consistent gets 121754 1117.07 6764.11 50.73db block gets 20628 189.25 1146 8.6physical reads 104695 960.5 5816.94 43.62
From V$SYSSTAT:
From report.txt:
![Page 101: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/101.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-9
Guidelines for Using the Cache Hit Ratio
Hit ratio peaks because of data access methods:
• Full table scans
• Data or application design
• Large table with random access
• Uneven distribution of cache hits
Guidelines for increasing the cache size:
• Cache hit ratio is less than 0.9
• No undue page faulting
• Previous increase was effective
![Page 102: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/102.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-10
Using Multiple Buffer Pools
SGADB buffer cachesLRU lists
KEEP pool
RECYCLE pool
DEFAULT pool
![Page 103: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/103.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-11
Defining Multiple Buffer Pools
...DB_BLOCK_BUFFERS = 20000DB_BLOCK_LRU_LATCHES = 6BUFFER_POOL_KEEP=(BUFFERS:14000,LRU_LATCHES:1)BUFFER_POOL_RECYCLE=(BUFFERS:2000,LRU_LATCHES:3)...
![Page 104: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/104.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-12
Defining Multiple Buffer Pools
• Pool blocks are taken from DB_BLOCK_BUFFERS
• Latches are taken from DB_BLOCK_LRU_LATCHES
• There are at least 50 blocks per latch
• DBA can define one, two, or three pools
![Page 105: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/105.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-13
Enabling Multiple Buffer Pools
CREATE INDEX cust_idx … STORAGE (BUFFER_POOL KEEP …);
ALTER TABLE customer STORAGE (BUFFER_POOL RECYCLE);
ALTER INDEX cust_name_idx REBUILD STORAGE (BUFFER_POOL KEEP);
![Page 106: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/106.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-14
Keep Buffer Pool Guidelines
• Tuning goal: Keep blocks in memory
• Size: Hold all or nearly all blocks
• Tool: ANALYZE ... ESTIMATE STATISTICS
SQL> ANALYZE TABLE codes ESTIMATE STATISTICS;
Table analyzed.
SQL> SELECT table_name, blocks 2 FROM dba_tables 3 WHERE owner = ’HR’ AND table_name = ’CODES’;
TABLE_NAME BLOCKS---------- ----------CODES 14
![Page 107: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/107.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-15
Recycle Buffer Pool Guidelines
• Tuning goal: Eliminate blocks from memory whentransactions have completed
• Size: Hold only active blocks
• Tool: V$CACHESQL> @catparr...
SQL> SELECT owner#, name, count(*) blocks 2 FROM v$cache 3 GROUP BY owner#, name;
OWNER# NAME BLOCKS------ ---------- ---------- 5 CUSTOMER 147...
![Page 108: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/108.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-16
Recycle Buffer Pool Guidelines
Tool: V$SESS_IO
SQL> SELECT io.block_gets, 2 io.consistent_gets, 3 io.physical_reads 4 FROM v$sess_io io, 5 v$session s 6 WHERE s.audsid = USERENV(’SESSIONID’) 7* AND io.sid = s.sid ;
BLOCK_GETS CONSISTENT_GETS PHYSICAL_READS---------- --------------- -------------- 2187 23271 1344
![Page 109: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/109.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-17
Calculating the Hit Ratio for Multiple Pools
SQL> @catperf...
SQL> SELECT name, 1 - (physical_reads / (db_block_gets +
consistent_gets)) "HIT_RATIO" 2 FROM sys.v$buffer_pool_statistics 3 WHERE db_block_gets + consistent_gets > 0;
NAME HIT_RATIO------------------ ----------KEEP .983520845RECYCLE .503866235DEFAULT .790350047
![Page 110: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/110.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-18
Identifying Candidate Pool Segments
• KEEP Pool– Blocks repeatedly accessed– Segment size is less than 10% of default buffer
pool size• RECYCLE Pool
– Blocks not reused outside of transaction– Segment size is more than twice the default
buffer pool size
![Page 111: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/111.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-19
Dictionary Views with Buffer Pools
SQL> SELECT * 2 FROM v$buffer_pool 3 WHERE id <> 0;
ID NAME LO_SETID HI_SETID SET_COUNT BUFFERS LO_BNUM HI_BNUM-- ------- -------- -------- --------- ------- ------- ------- 1 KEEP 3 3 1 14000 0 13999 2 RECYCLE 4 6 3 2000 14000 15999 3 DEFAULT 1 2 2 4000 16000 19999
![Page 112: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/112.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-20
Other Performance Indicators
SQL> SELECT event, total_waits 2 FROM v$system_event 3 WHERE event in 4 (’free buffer waits’, ’buffer busy waits’);
EVENT TOTAL_WAITS---------------------- -----------free buffer waits 337buffer busy waits 3466
From V$SYSTEM_EVENT:
SQL> SELECT name, value 2 FROM v$sysstat 3 WHERE name = ’free buffer inspected’;
NAME VALUE--------------------------- --------free buffer inspected 183
From V$SYSSTAT:
![Page 113: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/113.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-21
Caching Tables
Enable caching during full table scans by:
• Creating the table with the CACHE clause
• Altering the table with the CACHE clause
• Using the CACHE hint in a query
Guidelines: Do not overcrowd the cache.
![Page 114: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/114.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-22
LRU Latches
• LRU latches regulate the least recently used (LRU)lists used by the buffer cache.
• By default, the Oracle server sets the number ofLRU latches to one-half the number of CPUs, with aminimum of one.
• Each latch controls a minimum of 50 buffers.
![Page 115: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/115.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-23
LRU Latch Tuning Goals
• Ensure there are a sufficient number of LRUlatches for the data buffer cache, so thatcontention between server processes is minimized.
• Balance the number of latches with the number ofCPUs.
• Set one DBWn process for each latch.
![Page 116: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/116.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-24
Diagnosing LRU Latch Contention
V$LATCHNAMEV$SYSTEM_EVENTV$SESSION_EVENTV$BUFFER_POOL_STATISTICS
sleepsgetsname = “cache buffers lru chain”
SGA
Data buffer cacheLRU latch
Serverprocess
Serverprocess
V$LATCH
DB_BLOCK_LRU_LATCHES
![Page 117: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/117.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-25
Resolving LRU Latch Contention
If the hit percentage for the LRU latch isless than 99%:
• Increase the number of LRU latches by setting theparameter DB_BLOCK_LRU_LATCHES
• The maximum number of latches is the lower of:
– Number of CPUs x 2 x 3
– Number of buffers/50
![Page 118: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/118.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-26
Free Lists
• A free list for an object maintains a list of blocksthat are available for inserts.
• The number of free lists for an object cannot be setdynamically.
• Single-CPU systems do not benefit greatly frommultiple free lists.
• The tuning goal is to ensure that an object hassufficient free lists to minimize contention.
![Page 119: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/119.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-27
Diagnosing Free List Contention
V$WAITSTATclasscounttime“data blocks”
SGA
Data buffer cache
V$SYSTEM_EVENTeventtotal_waits
“buffer busy waits”
Serverprocess
Serverprocess
V$SESSION_WAIT
eventp1 “FILE”p2 “BLOCK”p3 “ID”
DBA_SEGMENTSsegment_namesegment_typefree listsheader_fileheader_block FREELISTS
![Page 120: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/120.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-28
Resolving Free List Contention
1. Query the V$SESSION_WAIT view.
2. Identify the object and get free lists for the segment from DBA_SEGMENTS.
3. Re-create the object in question.
![Page 121: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/121.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.6-29
Summary
In this lesson, you should have learned how to:• Get a high cache hit ratio• Adjust DB_BLOCK_BUFFERS as necessary• Separate objects into multiple buffer pools• Use multiple buffer pools• Cache tables• Resolve LRU latch contention• Avoid free list contention
![Page 122: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/122.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
77Tuning the Redo Log Buffer
![Page 123: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/123.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.7-2
Objectives
After completing this lesson, you should be able todo the following:
• Determine if processes are waiting for space in theredo log buffer
• Size the redo log buffer appropriately
• Reduce redo operations
![Page 124: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/124.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.7-3
The Redo Log Buffer
Databasebuffercache
Redologbuffer
Shared poolLibrary cache
Data dictionary cache
User Global Area
SQL> UPDATE emp
2 SET sal=sal*1.1
3 WHERE empno=7369;
Serverprocess
LGWR
Control files
Data files Redo logfiles
ARCn
Archivedlog files
![Page 125: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/125.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.7-4
Sizing the Redo Log Buffer
• LOG_BUFFER parameter
• Default value: OS-specific, generally four times themaximum block size
![Page 126: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/126.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.7-5
Tuning the Redo Log Buffer
SQL> UPDATE emp
2 SET sal=sal*1.1
3 WHERE empno=7369;
LGWR
Redo logfiles
ARCH
Archivedlog files
SQL> DELETE FROM s_emp
2 WHERE empno=7400;
Serverprocess
Serverprocess
![Page 127: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/127.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.7-6
Diagnostic Tools for Tuning the Redo LogBuffer
V$SESSION_WAITLog Buffer Space event
Redo log buffer
V$SYSSTATRedo Buffer Allocation Retries statistic
LOG_BUFFERLOG_CHECKPOINT_INTERVALLOG_CHECKPOINT_TIMEOUT
![Page 128: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/128.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.7-7
Guidelines
The Redo Buffer Allocation Retries value should be near 0;the number should be less than 1% of Redo Entries.
SQL> SELECT name, value
2 FROM v$sysstat
3 WHERE name IN (‘redo buffer allocation retries’,
4 ‘redo entries’);
There should be no Log Buffer Space waits.
SQL> SELECT sid, event, seconds_in_wait, state
2 FROM v$session_wait
3 WHERE event = ‘log buffer space’;
![Page 129: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/129.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.7-8
Guidelines
LGWR
Redo logfiles
ARCn
Archivedlog files
LOG_BUFFER = 32768 LOG_BUFFER = 131072
1.
2. LGWR
Redo logfiles
ARCn
Archivedlog files
Redo logfilesRedo log
filesRedo logfiles
![Page 130: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/130.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.7-9
Reducing Redo Operations
Fewer redo operations require fewer redo entries andthus less redo log buffer space.
Some ways of reducing the redo entries are:
• Direct Path loading without archiving
• Direct Path loading with archiving usingNOLOGGING mode
• Direct Load INSERT in NOLOGGING mode
• Using NOLOGGING mode in SQL statements
![Page 131: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/131.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.7-10
Summary
In this lesson, you should have learned how to:
• Tune log buffer space
• Redo buffer allocation retries
• Size the redo log buffer appropriately
• Reduce redo operations with the NOLOGGINGattribute
![Page 132: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/132.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
88Database Configuration and
I/O Issues
![Page 133: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/133.jpg)
8-2 Copyright Oracle Corporation, 1999. All rights reserved.
ObjectivesAfter completing this lesson, you should be able todo the following:
• Diagnose inappropriate use of SYSTEM, RBS,TEMP, DATA, and INDEX tablespaces
• Use locally managed tablespaces to avoid spacemanagement issues
• Detect I/O problems
• Ensure that files are distributed to minimize I/Ocontention and use appropriate type of devices
• Use striping where appropriate
• Tune checkpoints
• Tune DBWn process I/O
![Page 134: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/134.jpg)
8-3 Copyright Oracle Corporation, 1999. All rights reserved.
I/O Statistic for DifferentOracle File Types
Process
CKPT
DBWn
LGWR
ARCn
SERVER
Oracle File I/OData Files Log Archive Control
Write Write
Write
Write
Read Write Read/write
Read
![Page 135: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/135.jpg)
8-4 Copyright Oracle Corporation, 1999. All rights reserved.
Tablespace Usage
• Reserve the SYSTEM tablespace for data dictionaryobjects
• Create locally managed tablespaces to avoid spacemanagement issues
• Split tables and indexes into separate tablespaces
• Create separate rollback tablespaces
• Store very large database objects in their owntablespace
• Create one or more temporary tablespaces
![Page 136: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/136.jpg)
8-5 Copyright Oracle Corporation, 1999. All rights reserved.
Distributing Files Across Devices
• Separate data files and redo log files
• Stripe table data
• Reduce disk I/O
• Evaluate the use of raw devices
![Page 137: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/137.jpg)
8-6 Copyright Oracle Corporation, 1999. All rights reserved.
Oracle File Striping
Operating system striping:
• Use operating system striping software or RAID
• Decide on the right stripe size
Manual striping:
• Use the CREATE TABLE or ALTER TABLEALLOCATE command
• Is worthwhile with parallel query usage
![Page 138: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/138.jpg)
8-7 Copyright Oracle Corporation, 1999. All rights reserved.
Tuning Full Table Scan Operations
• Investigate the need for full table scans
• Specify the initialization parameterDB_FILE_MULTIBLOCK_READ_COUNT:
– To determine the number of database blocks theserver reads at once
– To influence the execution plan of the cost-basedoptimizer
• Monitor long-running full table scans withV$SESSION_LONGOPS view
![Page 139: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/139.jpg)
8-8 Copyright Oracle Corporation, 1999. All rights reserved.
Diagnostic Tools for Checking I/OStatistics
V$FILESTAT
V$DATAFILEData files
report.txt
Oracle I/O Utilization System I/O Utilization
Performancetools
![Page 140: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/140.jpg)
8-9 Copyright Oracle Corporation, 1999. All rights reserved.
I/O Statistics
SQL> Rem I/O should be spread evenly across drives. A big difference
between phys_reads and phys_blks_rd implies table scans are going on.
SQL> select table_space, file_name, phys_reads reads, phys_blks_rd
2> blks_read, phys_rd_time read_time, phys_writes writes, phys_blks_wr
3> blks_wrt, phys_wrt_tim write_time
4> from stats$files order by table_space, file_name;
TABLE_SPACE FILE_NAME READS BLKS_ READ_ WRITES BLKS_ WRITE_
READ TIME WRT TIME
------------- ----------------------- ------ --------- --------- ------ -------- ------
RBS /DISK2/rbs01.dbf 26 26 50 257 257 411
SCOTT_DATA /DISK4/scott_dat.dbf 65012 416752 38420 564 564 8860
SCOTT_INDEX /DISK4/scott_ind.dbf 8 8 0 8 8 0
SYSTEM /DISK1/sys01.dbf 806 1538 1985 116 116 1721
TEMP /DISK1/temp01.dbf 168 666 483 675 675 0
USER_DATA /DISK3/user01.dbf 8 8 0 8 8 0
6 rows selected.
![Page 141: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/141.jpg)
8-10 Copyright Oracle Corporation, 1999. All rights reserved.
Redo Log Groups and Members
Group 2 Group 3Group 1
Member
Member
Member
Member Member
Member
Disk 1
Disk 2
LGWR
![Page 142: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/142.jpg)
8-11 Copyright Oracle Corporation, 1999. All rights reserved.
Online Redo Log File Configuration
You can configure redo log files as follows:
• Size redo log files to minimize contention
• Have enough groups to prevent waiting
• Store redo log files on separate, fast devices
• Query the dynamic performance views V$LOGFILEand V$LOG
![Page 143: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/143.jpg)
8-12 Copyright Oracle Corporation, 1999. All rights reserved.
Archive Log File Configuration
• Allow the LGWR to write to a different disk from theone the ARCn process is reading
• Share the archiving work:
• Change archiving speed:LOG_ARCHIVE_MAX_PROCESSES,LOG_ARCHIVE_DEST_n,(LOG_ARCHIVE_DUPLEX_DEST,LOG_ARCHIVE_MIN_SUCCEED_DEST)
ALTER SYSTEM ARCHIVE LOG ALL
TO <log_archive_dest>
![Page 144: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/144.jpg)
8-13 Copyright Oracle Corporation, 1999. All rights reserved.
Diagnostic Tools
V$ARCHIVE_DEST
V$ARCHIVED_LOG
V$ARCHIVE_PROCESSES Archived logs
LOG_ARCHIVE_DEST_STATE_n
![Page 145: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/145.jpg)
8-14 Copyright Oracle Corporation, 1999. All rights reserved.
Checkpoints
• Checkpoints cause:
– DBWn to perform I/O
– CKPT to update the data file header and controlfile
• Frequent checkpoints:
– Reduce instance recovery time
– Decrease run-time performance
![Page 146: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/146.jpg)
8-15 Copyright Oracle Corporation, 1999. All rights reserved.
Guidelines
• Size the online redo log files to cut down thenumber of checkpoints.
• Add online redo log groups to increase the timebefore LGWR starts to overwrite.
• Regulate checkpoints with the initializationparameters:
– FAST_START_IO_TARGET
– LOG_CHECKPOINT_INTERVAL
– LOG_CHECKPOINT_TIMEOUT
– DB_BLOCK_MAX_DIRTY_TARGET
![Page 147: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/147.jpg)
8-16 Copyright Oracle Corporation, 1999. All rights reserved.
Multiple I/O Slaves
• Provide nonblocking asynchronous I/O requests
• Are deployed by DBWn, LGWR, ARCn, and backupprocesses
• Are typically not recommended if asynchronous I/Ois available
• Follow the naming convention ora_iNnn_SID
![Page 148: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/148.jpg)
8-17 Copyright Oracle Corporation, 1999. All rights reserved.
Initialization Parameters
Deploy I/O slaves for DBWn, LGWR, ARCn, andBACKUP processes with:
– DBWR_IO_SLAVES
– BACKUP_TAPE_IO_SLAVES
Turn on or off the asynchronous I/O with:
– DISK_ASYNCH_IO
– TAPE_ASYNCH_IO
![Page 149: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/149.jpg)
8-18 Copyright Oracle Corporation, 1999. All rights reserved.
Multiple DBWn Processes
• Deploy multiple DBWn processes withDB_WRITER_PROCESSES (DBW0 to DBW9)
• Useful for SMP systems with large numbers ofCPUs
• Cannot concurrently be used with multiple I/Oslaves
![Page 150: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/150.jpg)
8-19 Copyright Oracle Corporation, 1999. All rights reserved.
Tuning DBWn I/O
• Influence the DBWn to write dirty buffers more often withthe parameter DB_BLOCK_MAX_DIRTY_TARGET.
• If the number of dirty buffers is under the computed lowlimit, DBWn is not agressive for writing checkpointsbuffers.
• If the number is between the low and high computedlimits, DBWn writes from the checkpoint queue until thenumber of checkpoint buffers drops under low.
• If the number is greater than the high limit, DBWn writesout checkpoint buffers.
• The default value is (2*32) – 1.
![Page 151: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/151.jpg)
8-20 Copyright Oracle Corporation, 1999. All rights reserved.
Summary
In this lesson, you should have learned how to:
• Monitor I/O contention
• Stripe Oracle files
• Configure tablespaces, online redo log files, andarchived log files
• Configure checkpoint frequency
• Deploy I/O slaves
• Influence DBWn I/Os
![Page 152: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/152.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
99Using Oracle Blocks Efficiently
![Page 153: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/153.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-2
Objectives
After completing this lesson, you should be able todo the following:
• Determine an appropriate block size
• Optimize space usage within blocks
• Detect and resolve row migration
• Monitor and tune indexes
![Page 154: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/154.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-3
Tablespace
Database Storage Hierarchy
Segments
Blocks
ExtentsExtentsExtents
![Page 155: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/155.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-4
Allocating an ExtentAvoid dynamic extent allocationdisadvantages:
• Create locally managed tablespaces
• Size segment appropriately
• Monitor segments ready to extend
Tablespace
Segments
Blocks
ExtentsExtentsFullextents
Freespace
Incrementalextent
![Page 156: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/156.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-5
Avoiding Dynamic Allocation
SQL> SELECT owner, table_name, blocks, empty_blocks
2 FROM dba_tables
3 WHERE empty_blocks / (blocks+empty_blocks) < .1;
OWNER TABLE_NAME BLOCKS EMPTY_BLOCKS
------ ---------- ---------- ------------
HR EMP 1450 50
HR REGION 460 40
To display segments with less than 10% free blocks:
SQL> ALTER TABLE hr.emp ALLOCATE EXTENT;
Table altered.
To avoid dynamic allocation:
![Page 157: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/157.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-6
Avoiding Dynamic AllocationDisadvantages
Create a locally managed tablespace:
CREATE TABLESPACE user_data_1
DATAFILE ‘oracle8/oradata/db1/lm_1.dbf’
SIZE 100M
EXTENT MANAGEMENT LOCAL
UNIFORM SIZE 2M;
![Page 158: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/158.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-7
Pros and Cons of Large Extents
• Pros:
– Are less likely to dynamically extend
– Deliver small performance benefit
– Can overcome OS limitations on file size
– Single read against extent map
• Cons:
– Free space may not be available
– Unused space
![Page 159: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/159.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-8
Database Block Size
Tablespace
Segments
Blocks
Minimize block visits by:
• Using a larger block size
• Packing rows tightly
• Preventing row migration
ExtentsExtentsExtents
![Page 160: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/160.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-9
DB_BLOCK_SIZE
• Is set when the database is created• Is the minimum I/O unit for data file reads• Default is 2 KB or 4 KB, but up to 64 KB is allowed• Cannot be easily changed• Should be a multiple of the OS block size• OS I/O size is equal to or greater than
DB_BLOCK_SIZE
![Page 161: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/161.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-10
Small Block Size Pros and Cons
• Pros:
– Reduces block contention
– Is good for small rows
– Is good for random access
• Cons:
– Has relatively large overhead
– Has small number of rows per block
– Can cause more index blocks to be read
![Page 162: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/162.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-11
Large Block Size Pros and Cons
• Pros:
– Less overhead
– Good for sequential access
– Good for very large rows
– Better performance of index reads
• Cons:
– Increases block contention
– Uses more space in the buffer cache
![Page 163: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/163.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-12
PCTFREE and PCTUSED
Inserts
Inserts
Inserts
Inserts
1 2
3 4
![Page 164: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/164.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-13
Guidelines
• PCTFREE– Default 10
– Zero if no UPDATE activity
– PCTFREE = 100 × upd / (upd + ins)
• PCTUSED– Default 40
– Set if rows deleted
– PCTUSED = 100 – PCTFREE – 100 × rows ×
(ins + upd) / blocksize
![Page 165: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/165.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-14
Migration and Chaining
Index Table
![Page 166: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/166.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-15
Detecting Migration and Chaining
Detect migration and chaining using the ANALYZEcommand:
Statistic Total Per transaction ...
------------------------- ----- --------------- ...
table fetch continued row 495 .02 …
Detect migration and chaining from report.txt:
SQL> ANALYZE TABLE sales.order_hist COMPUTE STATISTICS;
Table analyzed.
SQL> SELECT num_rows, chain_cnt FROM dba_tables
2 WHERE table_name=‘ORDER_HIST’;
NUM_ROWS CHAIN_CNT
--------- ---------
168 102
![Page 167: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/167.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-16
Selecting Migrated Rows
SQL> ANALYZE TABLE sales.order_hist LIST CHAINED ROWS;
Table analyzed.
SQL> SELECT owner_name, table_name, head_rowid
2 FROM chained_rows
3 WHERE table_name = ’ORDER_HIST’;
OWNER_NAME TABLE_NAME HEAD_ROWID
---------- ---------- ------------------
SALES ORDER_HIST AAAAluAAHAAAAA1AAA
SALES ORDER_HIST AAAAluAAHAAAAA1AAB
...
![Page 168: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/168.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-17
Eliminating Migrated Rows
1. Run ANALYZE TABLE ... LIST CHAINED ROWS;
2. Copy the rows to another table.
3. Delete the rows from the original table.
4. Insert the rows from step 2 back into theoriginal table.
Step 4 eliminates migrated rows because migration onlyoccurs during an UPDATE operation.
![Page 169: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/169.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-18
The High-Water Mark
Empty blocks(rows deleted)
High-watermark
Empty blocks (never used)
Extent 1
Extent 2
Segment header block
• Recorded in segment header block
• Set to the beginning of the segment on creation
• Incremented in five-block increments as rows are inserted
• Reset by the TRUNCATE command and not DELETE
![Page 170: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/170.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-19
Table Statistics
SQL> ANALYZE TABLE hr.emp COMPUTE STATISTICS;
Table analyzed.
SQL> SELECT num_rows, blocks, empty_blocks as empty,
2 avg_space, chain_cnt, avg_row_len
3 FROM dba_tables
4 WHERE owner = ’HR’
5 AND table_name = ’EMP’;
NUM_ROWS BLOCKS EMPTY AVG_SPACE CHAIN_CNT AVG_ROW_LEN
-------- ------ ----- --------- --------- -----------
13214 615 35 1753 0 184
Query table statistics from the ANALYZE command:
![Page 171: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/171.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-20
The DBMS_SPACE Package
declare
owner VARCHAR2(30);
name VARCHAR2(30);
seg_type VARCHAR2(30);
tblock NUMBER;
...
BEGIN
dbms_space.unused_space
(’&owner’,’&table_name’,’TABLE’,
tblock,tbyte,ublock,ubyte,lue_fid,lue_bid,lublock);
dbms_output.put_line(...
END;
/
![Page 172: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/172.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-21
Index Reorganization
• Indexes on volatile tables cause aperformance problem.
• Empty index blocks go to the free list.
• Even if a block contains only oneentry, it must be maintained.
• You may need to rebuild indexes.
![Page 173: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/173.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-22
Monitoring Indexes
SQL> ANALYZE INDEX acct_no_idx VALIDATE STRUCTURE;
Index analyzed.
SQL> SELECT (DEL_LF_ROWS_LEN/LF_ROWS_LEN) * 100
2 AS index_usage
3 FROM index_stats;
INDEX_USAGE
-----------
24
SQL> ALTER INDEX acct_no_idx REBUILD;
Index altered.
![Page 174: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/174.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.9-23
Summary
In this lesson, you should have learned how to storeblocks as economically as possible by:
• Using a larger block size
• Setting PCTFREE and PCTUSED
• Rebuilding tables with many empty blocks
• Rebuilding tables with migrated rows
• Rebuilding volatile indexes
• Using locally managed tablespaces
![Page 175: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/175.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
1010Optimize Sort Operations
![Page 176: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/176.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-2
Objectives
After completing this lesson, you should be able todo the following:
• Identify the SQL operations that require sorting
• Ensure that sorting is done in memory wherepossible
• Reduce the number of I/Os required for the sortruns
• Allocate temporary space appropriately
![Page 177: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/177.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-3
Operations Requiring Sorting
• Index creation
• Parallel insert operation involving index maintenance
• ORDER BY or GROUP BY clauses
• DISTINCT values selection
• UNION, INTERSECT, or MINUS operators
• Sort-merge joins
• ANALYZE command execution
![Page 178: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/178.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-4
Sort Process
Sort space requirement is greater than SORT_AREA_SIZE:
Serverprocess
Sort run 1 Sort run 2
TEMPORARY tablespace
Sort run 2
Temporary segment Segments hold datawhile the server workson another sort run.
SORT_MULTIBLOCK_READ_COUNT forces the sort toread a larger section of each run into memory during amerge pass.
![Page 179: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/179.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-5
Sort Area and Parameters
The sort space is in:
Shared pool Stack space
Usersession
data
Cursorstate
Stack space
PGA• The PGA for dedicated server connections
• The shared pool for multithread server connections
Usersession
data
Cursorstate
PGA
UGA
UGA
Sort area
Sort area
SORT_AREA_SIZE = 64000
SORT_AREA_RETAINED_SIZE = 64000
![Page 180: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/180.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-6
Sort Area and Parameters
Each parallel query server needs SORT_AREA_SIZE.
Two sets of servers can write at once, so:
• Calculate SORT_AREA_SIZE × 2 × degree ofparallelism.
• Add SORT_AREA_RETAINED_SIZE × degree ofparallelism × number of sorts above two.
![Page 181: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/181.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-7
Sort Process and Temporary Space
A temporary tablespace is created with the commandCREATE TABLESPACE ... DATAFILE ... TEMPORARY
Temporary tablespace
temp03.dbf2M
temp02.dbf2M
temp01.dbf2M
Permanent Objects
One single sort segment
![Page 182: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/182.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-8
Temporary Space Segment
• Is created by the first sort operation
• Extends as demands are made on it
• Comprises extents, which can be used by differentsort operations
• Is described in the SGA in the sort extent pool(SEP)
![Page 183: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/183.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-9
Tuning Sort Operations
• Avoid sort operations whenever possible
• Reduce swapping and paging by ensuring that sortingis done in memory where possible
• Reduce space allocation calls: allocate temporaryspace appropriately
![Page 184: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/184.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-10
Avoiding Sort Operations
Avoid sort operations whenever possible by:
• Using NOSORT to create indexes
• Using UNION ALL instead of UNION
• Using index access for table joins
• Creating indexes on columns referenced in theORDER BY clause
• Selecting the columns for analysis
• Using ESTIMATE rather than COMPUTE for largeobjects
![Page 185: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/185.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-11
Diagnostic Tools
V$SYSSTAT
Sort area (UGA)
V$SORT_SEGMENTV$SORT_USAGE
report.txt
SORT_AREA_SIZESORT_AREA_RETAINED_SIZESORT_MULTIBLOCK_READ_COUNT
Serverprocess TEMPORARY
tablespace
(sorts(disk))(sorts(memory))
PCTINCREASEINITIALNEXT
![Page 186: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/186.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-12
Diagnostics and Guidelines
SQL> select disk.value "Disk", mem.value "Mem",
2 (disk.value/mem.value)*100 "Ratio"
3 from v$sysstat mem, v$sysstat disk
4 where mem.name = ’sorts (memory)’
5 and disk.name = ’sorts (disk)’;
Disk Mem Ratio
--------- --------- ---------
23 206 11.165049
• The ratio of disk sorts to memory sorts should beless than 5%.
• Increase the size of SORT_AREA_SIZE if the ratiois greater than 5%.
![Page 187: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/187.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-13
Monitoring Temporary Tablespaces
SQL> select tablespace_name, current_users, total_extents,
2 used_extents, extent_hits, max_used_blocks,
3 max_sort_blocks
4 from v$sort_segment;
TABLESPACE_NAME CURRENT_USERS TOTAL_EXTENTS USED_EXTENTS
EXTENT_HITS MAX_USED_BLOCKS MAX_SORT_BLOCKS
--------------- ------------- ------------- ------------
----------- --------------- ---------------
TEMP 2 4 3
20 200 200
• Default storage parameters apply to sort segments.
• Sort segments have unlimited extents.
![Page 188: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/188.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-14
Temporary Tablespace Configuration
• Set appropriate storage values.
• Set up different TEMPORARY tablespaces based onsorting needs.
SQL> SELECT session_num, tablespace, extents, blocks
2 FROM v$sort_usage;
SESSION_NUM TABLESPACE EXTENTS BLOCKS
----------- ---------------------- -------- --------
16 TEMP 4 200
• Stripe temporary tablespaces.
![Page 189: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/189.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.10-15
Summary
In this lesson, you should have learned how to:
• Avoid sort operations
• Size SORT_AREA_SIZE for sorting in memory
• Size SORT_MULTIBLOCK_READ_COUNT to reducethe number of I/Os
• Configure TEMPORARY tablespaces
![Page 190: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/190.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
1111
Rollback Segment Tuning
![Page 191: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/191.jpg)
11-2 Copyright Oracle Corporation, 1999. All rights reserved.
Objectives
After completing this lesson, you should be able todo the following:
• Use the dynamic performance views to checkrollback segment performance
• Reconfigure and monitor rollback segments
• Define the number and sizes of rollback segments
• Appropriately allocate rollback segments totransactions
![Page 192: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/192.jpg)
11-3 Copyright Oracle Corporation, 1999. All rights reserved.
Rollback Segments: Usage
Transactionrollback
Transactionrecovery
Rollbacksegment
Readconsistency
Controlfiles
Data files
Redologfiles
![Page 193: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/193.jpg)
11-4 Copyright Oracle Corporation, 1999. All rights reserved.
Rollback Segment Activity
Active extentInactive extent
4 3
1 2
>update>update>insert>insert>update
T1T2>update>update>insert>insert>update
T1T2
T3T4
![Page 194: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/194.jpg)
11-5 Copyright Oracle Corporation, 1999. All rights reserved.
Rollback Segment Header Activity
4 3
1 2
>update>update>insert>insert>update
T1T2>update>update>insert>insert>update
T3T4
T5T6
• Rollback segment headers contain entries for theirrespective transactions.
• Every transaction must have update access.
![Page 195: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/195.jpg)
11-6 Copyright Oracle Corporation, 1999. All rights reserved.
Growth of Rollback Segments
Active extent
Inactive extent
1 2
4 3
1 2
3
4
5
New extent
![Page 196: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/196.jpg)
11-7 Copyright Oracle Corporation, 1999. All rights reserved.
Transaction Types
Read-only Serializable
>SET TRANSACTION
READ ONLY;
>SELECT ...
>SELECT ...
>UPDATE ...
ORA-01456: may not
perform I/D/U
operation inside a
READ ONLY transaction
>SET TRANSACTION
ISOLATION LEVEL
SERIALIZABLE;
>SELECT ...
>SELECT ...
>UPDATE ...
>UPDATE ...
ORA-08177: can’t
serialize access for
this transaction
![Page 197: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/197.jpg)
11-8 Copyright Oracle Corporation, 1999. All rights reserved.
Tuning the Rollback Segments
• Transactions should never wait for access torollback segments.
• Rollback segments should not extend duringnormal running.
• Users and utilities should try to use less rollback.
• No transaction should ever run out of rollbackspace.
• Readers should always see the read-consistentimages they need.
![Page 198: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/198.jpg)
11-9 Copyright Oracle Corporation, 1999. All rights reserved.
Diagnostic Tools for Tuning RollbackSegments
4 3
1 2
T3T4T5T6
Data
Header
SGA
V$ROLLSTAT
V$ROLLNAMEV$TRANSACTION
V$SESSION
report.txt
V$SYSTEM_EVENT
V$ WAITSTAT
V$SYSSTAT
![Page 199: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/199.jpg)
11-10 Copyright Oracle Corporation, 1999. All rights reserved.
Diagnosing Rollback Segment HeaderContention
The ratio of the sum of waits to the sum of getsshould be less than 1%.
If not, create more rollback segments.
SQL> select sum(waits)* 100 /sum(gets) "Ratio",
2 sum(waits) "Waits", sum(gets) "Gets"
3 from v$rollstat;
Ratio Waits Gets
--------- --------- ---------
0.296736 5 1685
![Page 200: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/200.jpg)
11-11 Copyright Oracle Corporation, 1999. All rights reserved.
Diagnosing Rollback Segment Contention
SQL> select value from v$sysstat
2 where name = ’consistent gets’;
VALUE
----------
71563
The number of waits for any class should be lessthan 1% of the total number of requests.
If not, create more rollback segments.
![Page 201: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/201.jpg)
11-12 Copyright Oracle Corporation, 1999. All rights reserved.
Guidelines: How Many RollbackSegments?
• OLTP: One RBS for four transactions
• Batch: One rollback segment for each concurrentjob
Large rollback
Small RBS
Small RBS
Small RBS
Small RBS
Small RBS
Small RBS
SQL> SET TRANSACTION USE ROLLBACK SEGMENT large_rbs;
![Page 202: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/202.jpg)
11-13 Copyright Oracle Corporation, 1999. All rights reserved.
Guidelines: Sizing Rollback Segments
Rollback segment 2Rollback segment 1 =
...
INITIAL = NEXT= 2n
20 ...
INITIAL = NEXT= 2n
20
OPTIMAL = x OPTIMAL = y 0.00
0.10
0.20
0.30
0.40
0.50
0 10 20 30 40
Probabilityof extending
Number of extents
![Page 203: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/203.jpg)
11-14 Copyright Oracle Corporation, 1999. All rights reserved.
Sizing Transaction Rollback Data
• Deletes are expensive.
• Inserts use minimal rollback space.
• Updates use rollback space depending on thenumber of columns.
• Index maintenance adds rollback.
SQL> SELECT s.username, t.used_ublk, t.start_time 2 FROM v$transaction t, v$session s3 WHERE t.addr = s.taddr;
USERNAME USED_UBLK START_TIME-------------- ---------- --------------------SCOTT 2 11/16/95 10:26:39
![Page 204: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/204.jpg)
11-15 Copyright Oracle Corporation, 1999. All rights reserved.
Sizing Transaction Rollback Data
SQL> select usn,writes from v$rollstat;
USN WRITES
--------- ----------
1 4738
SQL> @upd
SQL> select usn,writes from v$rollstat;
USN WRITES
--------- ---------
1 1102686
The number of bytes in rollback segments beforeexecution of statements:
After execution of statements:
![Page 205: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/205.jpg)
11-16 Copyright Oracle Corporation, 1999. All rights reserved.
Using Less Rollback
• The design of the application should allow users tocommit regularly.
• Developers should not code long transactions.
![Page 206: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/206.jpg)
11-17 Copyright Oracle Corporation, 1999. All rights reserved.
Using Less Rollback
• Import
– Set COMMIT = Y
– Size the set of rows with BUFFER
• Export: Set CONSISTENT=N
• SQL*Loader: Set the COMMIT intervals with ROWS
![Page 207: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/207.jpg)
11-18 Copyright Oracle Corporation, 1999. All rights reserved.
Possible Problems
• Transaction fails for lack of rollback space• “Snapshot too old” error occurs if:
– The Interested Transaction List in the block beingqueried has been reused, and the SCN in the blockis newer than the SCN at the start of the query.
– The transaction slot in the rollback segment headerhas been reused.
– The undo data in the rollback segment has beenoverlaid after a commit.
![Page 208: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/208.jpg)
11-19 Copyright Oracle Corporation, 1999. All rights reserved.
Summary
In this lesson, you should have learned how to:
• Avoid contention for rollback segment headers
• Work out numbers and sizes of rollback segments
• Monitor the rollback space used by transactions
• Monitor the accurate value of the OPTIMAL storageparameter
• Identify possible rollback segment problems
![Page 209: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/209.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
1212
Monitoring and Detecting LockContention
![Page 210: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/210.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-2
Objectives
After completing this lesson, you should be able todo the following:
• Define types and modes of locking
• List possible causes of contention
• Use Oracle utilities to detect lock contention
• Resolve contention in an emergency
• Prevent locking problems
• Recognize Oracle errors arising from deadlocks
![Page 211: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/211.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-3
Locking Mechanism
• Automatic management
• High level of data concurrency
– Row-level locks for DML transactions
– No locks required for queries
• Varying levels of data consistency
• Exclusive and share lock modes
• Locks held until commit or rollback occurs
![Page 212: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/212.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-4
Two Types of Locks
• DML or data locks:
– Table-level locks
– Row-level locks
• DDL or dictionary locks
(TM)
(TX)
![Page 213: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/213.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-5
DML Locks
• A DML transaction acquires at least two locks:
– A shared table lock
– An exclusive row lock
• The enqueue mechanism keeps track of:
– Users waiting for locks
– The requested lock mode
– The order in which users requested the lock
![Page 214: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/214.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-6
Table Lock Modes
Automatically acquired:
• Row Exclusive (RX): INSERT, UPDATE, DELETE
• Row Share (RS): SELECT... FOR UPDATE
![Page 215: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/215.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-7
Table Lock Modes
Manually acquired in LOCK statement:
SQL> LOCK TABLE table_name IN mode_name MODE;
Share (S)
• No DML allowed
• Implicitly used for referential integrity
![Page 216: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/216.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-8
Table Lock Modes
Maunally acquired in LOCK statement:
• Share Row Exclusive (SRX)
– No DML or Share mode allowed
– Implicitly used for referential integrity
• Exclusive (X)
![Page 217: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/217.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-9
DML Locks in Block
Row 6
Block Header
Lock bytes
Row 1
1
2
TX slot 1 TX slot 2
![Page 218: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/218.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-10
DDL Locks
• Exclusive DDL locks:
– DROP TABLE statement
– ALTER TABLE statement
• Shared DDL locks:
– CREATE PROCEDURE statement
– AUDIT statement
• Breakable parse locks: Invalidating shared SQL area
![Page 219: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/219.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-11
Possible Causes of Lock Contention
• Unnecessarily high locking levels
• Uncommitted changes
• Other products imposing higher-level locks
![Page 220: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/220.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-12
> UPDATE emp SET sal = sal x 1.1 WHERE empno = 1000;
Diagnostic Tools for Monitoring LockingActivity
V$LOCK
V$LOCKED_OBJECT
Transaction 1
> UPDATE emp SET sal = sal x 1.1;
Transaction 2 Transaction 3
> UPDATE emp SET sal = sal x 1.1 WHERE empno = 2000;
EM TopSessions
![Page 221: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/221.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-13
TopSessions (Diagnostic Pack)• All Locks
• Blocking/Waiting Locks
![Page 222: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/222.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-14
9:00
9:05
10:30
11:30
Transaction 1
Guidelines: Resolve Contention
> UPDATE emp SET sal = sal x 1.1 WHERE empno = 1000;
>COMMIT/ROLLBACK;
>
> UPDATE emp SET sal = sal x 1.1 WHERE empno = 1000;
1 row updated;
>
Transaction 2
>ALTER SYSTEM KILL SESSION ‘10,23’;
![Page 223: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/223.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-15
Transaction
2
Transaction
1
Deadlocks
> UPDATE emp SET sal = sal x 1.1 WHERE empno = 1000;
UPDATE emp SET sal = sal x 1.1 WHERE empno = 2000;
ORA-00060:Deadlock detected whilewaiting for resource
> UPDATE emp SET mgr = 1342 WHERE empno = 2000;
> UPDATE emp SET mgr = 1342 WHERE empno = 1000;
9:00
9:15
9:16
![Page 224: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/224.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-16
Deadlocks
ORA-00060:Deadlock detected whilewaiting for resource
Trace file
Serverprocess
in USER_DUMP_DEST directory
SID_ora_PID.trc
UNIX
![Page 225: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/225.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.12-17
Summary
In this lesson, you should have learned that:
• Queries do not lock data, unless specified in thequery
• DML statements use row-level and table-level lockson tables
• Exclusive locks are rarely used
• You can monitor locks using:
– V$LOCK, V$LOCKED_OBJECT
– Oracle Enterprise Manager TopSessions
![Page 226: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/226.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
1313SQL Issues and Tuning Considerations
for Different Applications
![Page 227: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/227.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-2
Objectives
After completing this lesson, you should be able todo the following:
• Identify the role of the DBA in application tuning
• Use optimizer modes to enhance SQL statementperformance
• Manage stored outlines to store execution paths asa series of hints
![Page 228: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/228.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-3
Objectives
• Use the available data access methods to tune thephysical design of the database
• Identify the demands of online transactionprocessing (OLTP) systems
• Identify the demands of decision support systems(DSS)
• Reconfigure systems on a temporary basis forparticular needs
![Page 229: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/229.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-4
The Role of the DBA
• Application tuning is the most important part oftuning.
• DBAs may not be directly involved in applicationtuning.
• DBAs must be familiar with the impact that poorlywritten SQL statements can have upon databaseperformance.
![Page 230: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/230.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-5
Diagnostic Tools Overview
• EXPLAIN PLAN
• SQL Trace and TKPROF
• SQL*Plus AUTOTRACE
• Oracle SQL Analyze
![Page 231: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/231.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-6
Explain Plan
• Can be used without tracing
• To use the explain plan:
1. Create PLAN_TABLE with utlxplan.sql.
2. Run the EXPLAIN PLAN SQL command.
3. Query PLAN_TABLE to display the execution plans.
SQL> @$ORACLE_HOME/rdbms/admin/utlxplan
![Page 232: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/232.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-7
SQL Trace and TKPROF
1. Set the initialization parameters.
2. Invoke SQL Trace.
3. Run the application.
4. Turn off SQL Trace.
5. Format the trace file with TKPROF.
6. Interpret the output.
![Page 233: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/233.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-8
Enabling and Disabling SQL Trace
• Instance level:SQL_TRACE = {TRUE|FALSE}
• Session level:
SQL> alter session set SQL_TRACE = {true|false};
SQL> execute DBMS_SESSION.SET_SQL_TRACE
2 ({true|false});
SQL> execute DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION
2 (session_id, serial_id, {true|false});
![Page 234: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/234.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-9
Formatting the Trace Filewith TKPROF
$ tkprof tracefile.trc output.txt [options]
tracefile.trc output.txt
USER_DUMP_DEST
![Page 235: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/235.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-10
TKPROF Statistics
• Count: Number of execution calls
• CPU: CPU seconds used
• Elapsed: Total elapsed time
• Disk: Physical reads
• Query: Logical reads for consistent read
• Current: Logical reads in current mode
• Rows: Rows processed
![Page 236: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/236.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-11
SQL*Plus AUTOTRACE
• Create PLAN_TABLE
• Run plustrce.sql from theORACLE_HOME/sqlplus/admin directory
• AUTOTRACE syntax:
SQL> @ORACLE_HOME/sqlplus/admin/plustrce.sql
SQL> grant plustrace to scott;
set autotrace [ off | on | traceonly ]
[ explain | statistics ]
![Page 237: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/237.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-12
Optimizer Modes
• Rule-based:
– Uses a ranking system
– Syntax- and data dictionary–driven
• Cost-based:
– Chooses least-cost path
– Statistics-driven
![Page 238: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/238.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-13
Setting the Optimizer Mode
• Instance level:
optimizer_mode ={choose|rule|first_rows|all_rows}
• Session level:
alter session set optimizer_mode ={choose|rule|first_rows|all_rows}
• Statement level: Using hints
![Page 239: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/239.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-14
Managing Statistics
• Use the ANALYZE command to collect or deletestatistics.
• Use the DBMS_STATS package:
– GATHER_TABLE_STATS
– GATHER_INDEX_STATS
– GATHER_SCHEMA_STATS
– GATHER_DATABASE_STATS
![Page 240: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/240.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-15
Table Statistics
• Number of rows
• Number of blocks and empty blocks
• Average available free space
• Number of chained or migrated rows
• Average row length
• Last ANALYZE date and sample size
• Data dictionary view: DBA_TABLES
![Page 241: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/241.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-16
Index Statistics
• Index level (height)
• Number of leaf blocks and distinct keys
• Average number of leaf blocks per key
• Average number of data blocks per key
• Number of index entries
• Clustering factor
• Data dictionary view: DBA_INDEXES
![Page 242: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/242.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-17
Column Statistics
• Number of distinct values
• Lowest value, highest value
• Last ANALYZE date and sample size
• Data dictionary view:USER_TAB_COL_STATISTICS
![Page 243: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/243.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-18
Histograms
• Describe the data distribution of a particularcolumn in more detail
• Better predicate selectivity estimates for unevenlydistributed data
• Create histograms withANALYZE TABLE ... FOR COLUMNS ...
• Data dictionary view: DBA_HISTOGRAMS
![Page 244: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/244.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-19
1
Copying Statistics Between Databases
Copyto user table
User-defined statistics table Data dictionary
User-defined statistics tableData dictionary
ExportImport
Copy usertable to DD
43
2
![Page 245: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/245.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-20
Example: Copying Statistics
DBMS_STATS.EXPORT_TABLE_STATS(’TRAIN’ /* schema name */,’COURSES’ /* table name */, NULL /* no partitions */,’STATS’ /* statistics table name */,’CRS990601’ /* id for statistics */, TRUE /* index statistics */);
DBMS_STATS.CREATE_STAT_TABLE('TRAIN' /* schema name */,'STATS' /* statistics table name */,'USERS' /* tablespace */);
![Page 246: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/246.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-21
Optimizer Plan Stability
• Allows applications to force the use of a desiredSQL access path
• Maintains consistent execution path throughdatabase changes
• Is implemented using a stored outline consisting ofhints
![Page 247: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/247.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-22
Plan Equivalence
• SQL statement text must match
• Plans are maintained through:
– New Oracle versions
– New statistics on objects
– Initialization parameter changes
– Database reorganization
– Schema changes
![Page 248: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/248.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-23
Creating Stored Outlines
SQL> alter session 2 set CREATE_STORED_OUTLINES = train;SQL> select … from … ;SQL> select … from … ;
SQL> create or replace OUTLINE co_cl_join 2 FOR CATEGORY train ON 3 select co.crs_id, ... 4 from courses co 5 , classes cl 6 where co.crs_id = cl.crs_id;
![Page 249: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/249.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-24
Using Stored Outlines
• Set the USE_STORED_OUTLINES parameter toTRUE or to a category name
• Both CREATE_STORED_OUTLINES andUSE_STORED_OUTLINES can be set at theinstance or session level
SQL> alter session 2 set USE_STORED_OUTLINES = train;SQL> select … from … ;
![Page 250: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/250.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-25
Maintaining Stored Outlines
• Use the OUTLN_PKG package to:
– Drop outlines or categories of outlines
– Rename categories
• Use the ALTER OUTLINE command to:
– Rename an outline
– Rebuild an outline
– Change the category of an outline• Outlines are stored in OUTLN schema
![Page 251: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/251.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-26
Data Access Methods
To enhance performance, you can use the followingdata access methods:
• Indexes (B-tree, bitmap, reverse key)
• Index-organized tables
• Clusters
• Histograms
• Materialized views
![Page 252: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/252.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-27
B-Tree Index
Index entry headerKey column lengthKey column valueROWID
Root
Branch
Leaf
Index entry
![Page 253: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/253.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-28
Bitmap Index
<Blue, 10.0.3, 12.8.3, 1000100100010010100>
<Green, 10.0.3, 12.8.3, 0001010000100100000>
<Red, 10.0.3, 12.8.3, 0100000011000001001>
<Yellow, 10.0.3, 12.8.3, 0010001000001000010>
KeyStartROWID
EndROWID Bitmap
Table
Index
Block 10
Block 11
Block 12
File 3
![Page 254: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/254.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-29
Bitmap Indexes
• Used for low-cardinality columns
• Good for multiple predicates
• Use minimal storage space
• Best for read-only systems
• Good for very large tables
![Page 255: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/255.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-30
Creating and MaintainingBitmap Indexes
SQL> create BITMAP INDEX ord_region_id_idx
2 on ord(region_id)
3 storage (initial 200k next 200k
4 pctincrease 0 maxextents 50)
5 tablespace indx01;
![Page 256: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/256.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-31
Comparing B-Tree andBitmap Indexes
B-Tree indexes Bitmap indexes
Suitable for high-cardinality Suitable for low-cardinality columns columns
Updates on keys relatively Updates to key columns very inexpensive expensive
Inefficient for queries using Efficient for queries usingOR predicates OR predicates
Row-level locking Bitmap segment-level locking
More storage Less storage
Useful for OLTP Useful for DSS
![Page 257: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/257.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-32
KEY ROWID----- -------------------1257 0000000F.0002.00012877 0000000F.0006.00014567 0000000F.0004.00016657 0000000F.0003.00018967 0000000F.0005.00019637 0000000F.0001.00019947 0000000F.0000.0001... ...
Reverse Key Index
Index on EMPNO EMP Table
EMPNO ENAME JOB ...----- ----- -------- ---7499 ALLEN SALESMAN7369 SMITH CLERK7521 WARD SALESMAN ...7566 JONES MANAGER7654 MARTIN SALESMAN7698 BLAKE MANAGER7782 CLARK MANAGER... ... ...
![Page 258: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/258.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-33
Creating Reverse Key Indexes
SQL> create unique index i1_t1 ON t1(c1)
2 REVERSE pctfree 30
3 storage(initial 200k next 200k
4 pctincrease 0 maxextents 50)
5 tablespace indx01;
SQL> create unique index i2_t1 ON t1(c2);
SQL> alter index i2_t1 REBUILD REVERSE;
![Page 259: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/259.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-34
Regular table access
ROWID
Index-Organized Tables
IOT access
Non-key columnsKey columnRow header
![Page 260: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/260.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-35
Index-Organized TablesCompared with Regular Tables
• Faster key-based access to table data
• Reduced storage requirements
• Secondary indexes and logical ROWIDs
• Main restrictions:
– Must have a primary key
– Cannot use unique constraints
– Cannot be clustered
![Page 261: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/261.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-36
Creating Index-Organized Tables
SQL> create table sales
2 (office_cd number(3)
3 ,qtr_end date
4 ,revenue number(10,2)
5 ,review varchar2(1000) 6 ,constraint sales_pk
7 PRIMARY KEY (office_cd,qtr_end)
8 )
9 ORGANIZATION INDEX tablespace indx
10 PCTTHRESHOLD 20
11 INCLUDING revenue
12 OVERFLOW TABLESPACE user_data;
![Page 262: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/262.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-37
Segment = SYS_IOT_OVER_nIOT_type = IOT_OVERFLOWSegment_type = TABLE
Segment = SALES_PKIOT_type = IOTSegment_type = INDEXIndex_type = IOT - TOP
IOT Row Overflow
Remaining row partRows within PCTTHRESHOLD
INDX tablespace USER_DATA tablespace
![Page 263: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/263.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-38
IOT Dictionary Views
SQL> select table_name,tablespace_name,iot_name,iot_type 2 from DBA_TABLES;
TABLE_NAME TABLESPACE_NAME IOT_NAME IOT_TYPE----------------- --------------- -------- ------------
SALES IOTSYS_IOT_OVER_2268 USER_DATA SALES IOT_OVERFLOW
SQL> select index_name,index_type,tablespace_name,table_name 2 from DBA_INDEXES;
INDEX_NAME INDEX_TYPE TABLESPACE TABLE_NAME------------- ---------- ---------- ----------
SALES_PK IOT - TOP INDX SALES
SQL> select segment_name,tablespace_name,segment_type
2 from DBA_SEGMENTS;
SEGMENT_NAME TABLESPACE SEGMENT_TYPE----------------- ---------- ------------
SYS_IOT_OVER_2268 USER_DATA TABLESALES_PK INDX INDEX
![Page 264: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/264.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-39
Clusters
Clustered ORDand ITEM tables
Cluster Key(ORD_NO) 101 ORD_DT CUST_CD 05-JAN-97 R01
PROD QTYA4102 20A5675 19 W0824 10
102 ORD_DT CUST_CD 07-JAN-97 N45
PROD QTYA2091 11G7830 20 N9587 26
Unclustered ORDand ITEM tables
ORD_NO PROD QTY ...----- ------ ------101 A4102 20102 A2091 11102 G7830 20 102 N9587 26101 A5675 19101 W0824 10
ORD_NO ORD_DT CUST_CD------ ------ ------
101 05-JAN-97 R01102 07-JAN-97 N45
![Page 265: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/265.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-40
Cluster Types
Indexcluster
Hashcluster
Hash function
![Page 266: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/266.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-41
Situations in Which ClustersAre Useful
Criterion
Uniform key distribution
Evenly distributed key values
Rarely updated key
Often joined master-detail tables
Predictable number of key values
Queries using equality predicate on key
Hash
X
X
X
X
X
Index
X
X
X
![Page 267: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/267.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-42
Materialized Views
• Are instantiations of a SQL query
• Can be used for query rewrites
• Refresh types:
– Complete or fast
– Force or never
• Refresh modes:
– Manual
– Automated (synchronous or asynchronous)
![Page 268: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/268.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-43
Materialized Views: Manual Refresh
Refresh-specific MVs:
MVs based on one or more base tables:
All MVs due for refresh:
DBMS_MVIEW.REFRESH(’SF_SALES’, parallelism => 10);
DBMS_MVIEW.REFRESH_DEPENDENT(’SALES’);
DBMS_MVIEW.REFRESH_ALL_MVIEWS;
![Page 269: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/269.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-44
Query Rewrites
• To use MVs instead of the base tables, a query mustbe rewritten.
• Query rewrites are transparent and do not requireany special privileges on the MV.
• MVs can be enabled or disabled for query rewrites.
![Page 270: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/270.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-45
Query Rewrites
• The initialization parameterQUERY_REWRITE_ENABLED must be set to TRUE.
• The QUERY REWRITE privilege allows users toenable materialized views.
• The DBMS_OLAP package has options to usematerialized views.
![Page 271: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/271.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-46
Materialized Views andQuery Rewrites: Example
SQL> create MATERIALIZED VIEW sales_summary 2 tablespace sales_ts 3 parallel (degree 4) 4 BUILD IMMEDIATE REFRESH FAST 5 ENABLE QUERY REWRITE 6 AS 7 select s.zip, p.product_type 8 , sum(s.amount) 9 from sales s, product p 10 where s.product_id = p.product_id 11 group by s.zip, p.product_type;
![Page 272: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/272.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-47
Materialized Views andQuery Rewrites: Example
SQL> select s.zip, p.product_type, sum(s.amount) 2 from sales s, product p 3 where s.product_id = p.product_id 4 group by s.zip, p.product_type;
OPERATION NAME---------------------- -----------------SELECT STATEMENT TABLE ACCESS FULL SALES_SUMMARY
![Page 273: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/273.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-48
Enabling and ControllingQuery Rewrites
• Initialization parameters:– OPTIMIZER_MODE
– QUERY_REWRITE_ENABLED
– QUERY_REWRITE_INTEGRITY
• Dynamic and session-level parameters:– QUERY_REWRITE_ENABLED
– QUERY_REWRITE_INTEGRITY
• New hints: REWRITE and NOREWRITE
![Page 274: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/274.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-49
Disabling Query Rewrites: Example
SQL> select /*+ NOREWRITE */ 2 s.zip, p.product_type, sum(s.amount) 3 from sales s, product p 4 where s.product_id = p.product_id 5 group by s.zip, p.product_type;
OPERATION NAME----------------------------- -----------SELECT STATEMENT SORT GROUP BY HASH JOIN TABLE ACCESS FULL SALES . . .
![Page 275: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/275.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-50
• High throughput, insert- and update-intensive
• Large, continuously growing data volume
• Concurrent access by many users
• Tuning goals:
– Availability
– Speed
– Concurrency
– Recoverability
OLTP Systems
![Page 276: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/276.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-51
OLTP Requirements
• Explicit space allocation• Indexes:
– Not too many (prefer B-tree to bitmap)– Reverse key for sequence columns– Rebuilt regularly
• Clusters for tables in join queries:– Index clusters for growing tables– Hash clusters for stable tables
![Page 277: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/277.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-52
OLTP Requirements
• Short transactions do not require big rollbacksegments; multiple rollback segments preventcontention.
• A large MINEXTENTS value is required.
SQL> create rollback segment rbs01
2 storage (initial 100k next 100k
3 minextents 20 maxextents 121
4 optimal 400k )
5 tablespace rbs;
![Page 278: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/278.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-53
OLTP Application Issues
• Use database constraints instead of applicationcode.
• Make sure that code is shared.
• Use bind variables rather than literals for optimallyshared SQL.
![Page 279: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/279.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-54
• Queries on large amounts of data
• Heavy use of full table scans
• Tuning goals:
– Fast response time
– Accuracy
– Availability
• Parallel Query is particularly designedfor DSS environments
DSS Systems
Data
Data
![Page 280: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/280.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-55
DSS Requirements
Storage allocation:• Set db_block_size anddb_file_multiblock_read_count carefully.
• Ensure that extent sizes are multiples of thisparameter value.
• Run ANALYZE regularly.
![Page 281: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/281.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-56
DSS Requirements
• Evaluate the need for indexes:– Use bitmap indexes when possible.– Use index-organized tables for (range)
retrieval by PK.– Generate histograms for indexed columns
that are distributed nonuniformly.• Clustering: Consider hash clusters for
performance access.
![Page 282: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/282.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-57
DSS Application Issues
• Parse time is less important.
• The execution plan must be optimal.
– Use the Parallel Query feature.
– Tune carefully, using hints if appropriate.
– Test on realistic amounts of data.
– Consider using PL/SQL functions to code logicinto queries.
• Bind variables are problematic.
![Page 283: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/283.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-58
• Combination of OLTP and DSS
• Hybrid systems rely on several configurations
Multipurpose Applications
Data Data
![Page 284: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/284.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-59
Hybrid Systems
OLTP DSSPerforms index searches More full table scans
Uses B-tree indexes Uses bitmap indexes
Uses reverse key indexes Uses IOT tables
Needs more, small rollback Fewer, large rollbacksegments segments
Should not use parallel query Employs parallel query forlarge operations
PCTFREE according to PCTFREE can be set to 0expected update activity
Shared code and bind variables Literal variables and hints
Uses ANALYZE indexes Histograms generation
![Page 285: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/285.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-60
Parameters for Hybrid Systems
• Memory use:
– SHARED_POOL_SIZE
– LARGE_POOL_SIZE
– DB_BLOCK_BUFFERS
– SORT_AREA_SIZE
• Parallel Query: Reconfigure parameters for DSS
![Page 286: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/286.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-61
Hybrid Systems Configuration
• Online rollback segments:
– More small ones during the day
– Fewer, large ones at night
• Multithreaded server (MTS):For peak-time use, not for DSS
![Page 287: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/287.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-62
Summary
In this lesson, you should have learned that:
• Application tuning often results in the greatestperformance benefits.
• You tune CBO with parameters and hints.
• You use stored outlines for plan stability.
• You should apply available data access methodsappropriately.
![Page 288: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/288.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-63
Summary
For OLTP, try to reach the following goals:
• Immediate access to small amounts of data(indexing, hashing)
• Immediate concurrent access to transaction tables
• Shared code to cut down parse time
• No space allocation during peak hours
![Page 289: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/289.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.13-64
Summary
For DSS, try to reach the following goals:
• Data tightly packed into large blocks
• Careful tuning of queries
• Histograms generation
• Query rewrites using materialized views anddimensions
• Well-configured Parallel Query support
![Page 290: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/290.jpg)
14
Copyright Oracle Corporation, 1999. All rights reserved.®
Managing a Mixed Workload
![Page 291: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/291.jpg)
14-2 Copyright Oracle Corporation, 1999. All rights reserved.®
Objectives
After completing this lesson, you should be able todo the following:
• List the features of Database Resource Manager
• Limit the use of resources using DatabaseResource Manager
![Page 292: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/292.jpg)
14-3 Copyright Oracle Corporation, 1999. All rights reserved.®
Overview
• Manage a mixed workload
• Control processing resources used
DSS users
OLTP users
Database Resource Manager
DSSLess resources
Oracle8iDatabase
OLTPMore resources
![Page 293: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/293.jpg)
14-4 Copyright Oracle Corporation, 1999. All rights reserved.®
Database Resource ManagementConcepts
• Groups users with similarresource needs
• Allocates CPU and PQservers
• Only one plan active
• Assigns groups to plans
• Allocates resources
Resourceplandirectives
Resourceplan
Resourceconsumergroup
![Page 294: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/294.jpg)
14-5 Copyright Oracle Corporation, 1999. All rights reserved.®
Resource Consumer Groups
Consumergroup1
Consumergroup2
User
• Users can be members ofmultiple consumer groups.
• A default group is assigned to auser at login.
• Only one group is active at a timefor a session.
• Either the user or DBA can switchthe consumer group during asession.
• Groups are created with thedatabase.
![Page 295: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/295.jpg)
14-6 Copyright Oracle Corporation, 1999. All rights reserved.®
• Manage parallelism:
– Method: Absolute
– Allocate PQ servers for an operation
– Limit degree of parallelism
• Manage CPU usage:
– Method: Emphasis
– Allocate based on percentages at differentlevels
– Delay work that exceeds CPU limits
Resource Plan Directives
![Page 296: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/296.jpg)
14-7 Copyright Oracle Corporation, 1999. All rights reserved.®
Database Resource ManagementExample
Consumer ParallelismPlan Level Group CPU Degree
DAY 1 SYS_GROUP 100% 20
2 OLTP 100% 0
3 DSS 100% 20
NIGHT 1 SYS_GROUP 100% 20
2 OLTP 25% 0
2 DSS 75% 20
3 OLTP 100% 0
![Page 297: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/297.jpg)
14-8 Copyright Oracle Corporation, 1999. All rights reserved.®
Steps in Database Resource Management
1. Assign the resource manager system privilegesto the administrator.
2. Create resource objects with the packageDBMS_RESOURCE_MANAGER:
– Resource consumer groups
– Resource plans
– Resource plan directives3. Assign users to groups with the package
DBMS_RESOURCE_MANAGER_PRIVS.4. Specify the plan to be used by the instance.
![Page 298: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/298.jpg)
14-9 Copyright Oracle Corporation, 1999. All rights reserved.®
Assigning the Resource ManagerPrivilege
1. Assign the resource manager system privileges tothe administrator.
DBMS_RESOURCE_MANAGER_PRIVS.
GRANT_SYSTEM_PRIVILEGE (
grantee_name => ’SCOTT’,
privilege_name
=> ’ADMINISTER_RESOURCE_MANAGER’,
admin_option => FALSE );
![Page 299: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/299.jpg)
14-10 Copyright Oracle Corporation, 1999. All rights reserved.®
Creating Database ResourceManager Objects
2. Create resource objects with the packageDBMS_RESOURCE_MANAGER.2.1. Create a pending area.
2.2. Create resource consumer groups.
DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP (
consumer_group => ’OLTP’,
comment => ’Online users’ );
![Page 300: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/300.jpg)
14-11 Copyright Oracle Corporation, 1999. All rights reserved.®
Creating Database Resource ManagerObjects
2.3 Create resource plans.
DBMS_RESOURCE_MANAGER.CREATE_PLAN (
plan => ’NIGHT’,
comment => ’DSS/Batch priority, ...’ );
DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE (
plan => ’NIGHT’,
group_or_subplan => ’SYS_GROUP’,
comment => ’...’,
cpu_p1 => 100,
parallel_degree_limit_p1 => 20);
2.4 Create resource plan directives.
![Page 301: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/301.jpg)
14-12 Copyright Oracle Corporation, 1999. All rights reserved.®
Creating Database Resource ManagerObjects
2.5. Validate the pending area.
2.6. Commit the pending area.
DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
![Page 302: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/302.jpg)
14-13 Copyright Oracle Corporation, 1999. All rights reserved.®
Assigning Users to Consumer Groups
3. Assign users to groups.
Set the initial consumer group for users
DBMS_RESOURCE_MANAGER_PRIVS.
GRANT_SWITCH_CONSUMER_GROUP (
grantee_name => ’MOIRA’,
consumer_group => ’OLTP’,
grant_option => FALSE );
DBMS_RESOURCE_MANAGER.
SET_INITIAL_CONSUMER_GROUP (
user => ’MOIRA’,
consumer_group => ’OLTP’ );
![Page 303: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/303.jpg)
14-14 Copyright Oracle Corporation, 1999. All rights reserved.®
Setting the Resource Plan for an Instance
4. Specify the plan to be used by the instance.
– Specify the RESOURCE_MANAGER_PLANinitialization parameter.
– Change the resource plan without shuttingdown and restarting the instance.
RESOURCE_MANAGER_PLAN=day
ALTER SYSTEM
SET RESOURCE_MANAGER_PLAN=night;
![Page 304: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/304.jpg)
14-15 Copyright Oracle Corporation, 1999. All rights reserved.®
Changing a Consumer GroupWithin a Session
The user or the application can switch the currentconsumer group.
DBMS_SESSION.
SWITCH_CURRENT_CONSUMER_GROUP (
new_consumer_group => ’DSS’,
old_consumer_group => v_old_group,
initial_group_on_error => FALSE );
![Page 305: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/305.jpg)
14-16 Copyright Oracle Corporation, 1999. All rights reserved.®
Changing Consumer Groups for Sessions
• Can be set by DBA for a session
• Can be set by DBA for all sessions for a user
DBMS_RESOURCE_MANAGER.
SWITCH_CONSUMER_GROUP_FOR_SESS (
session_id => 7,
session_serial => 13,
consumer_group => ’OLTP’);
DBMS_RESOURCE_MANAGER.
SWITCH_CONSUMER_GROUP_FOR_USER (
user => ’MOIRA’,
consumer_group => ’OLTP’);
![Page 306: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/306.jpg)
14-17 Copyright Oracle Corporation, 1999. All rights reserved.®
• DBA_RSRC_PLANS
Resource plans and status
• DBA_RSRC_PLAN_DIRECTIVES
Resource plan directives and status
• DBA_RSRC_CONSUMER_GROUPS
Consumer groups and status
• DBA_RSRC_CONSUMER_GROUP_PRIVS
Users granted consumer groups
• DBA_USERS
Column:INITIAL_RSRC_CONSUMER_GROUP
Database Resource Manager Information
![Page 307: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/307.jpg)
14-18 Copyright Oracle Corporation, 1999. All rights reserved.®
• V$SESSION: Contains theRESOURCE_CONSUMER_GROUPcolumn that shows the current group for asession
• V$RSRC_PLAN: A view that show the activeresource plan
• V$RSRC_CONSUMER_GROUP: A view thatcontains statistics by consumer group
Current Database ResourceManager Settings
![Page 308: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/308.jpg)
14-19 Copyright Oracle Corporation, 1999. All rights reserved.®
Summary
In this lesson, you should have learned how tocontrol the use of CPUs and the degree of parallelismusing Database Resource Manager.
![Page 309: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/309.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
1515
Tuning with Oracle Expert
![Page 310: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/310.jpg)
15-2 Copyright Oracle Corporation, 1999. All rights reserved.
Objectives
After completing this lesson, you should be able todo the following:
• Describe the features of Oracle Expert
• Create a tuning session
• Gather, view, and edit the input data
• Analyze the collected data, using rules
• Review tuning recommendations
• Implement tuning recommendations
![Page 311: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/311.jpg)
15-3 Copyright Oracle Corporation, 1999. All rights reserved.
Overview of Oracle Expert TuningMethodology
Specify tuning scope
Collect data
View and edit data and rules
Analyze data to generate recommendations
Review recommendations
Implement recommendations
NU-3599A-RA
![Page 312: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/312.jpg)
15-4 Copyright Oracle Corporation, 1999. All rights reserved.
Types of Tuning
• Routine tuning
• Focused tuning
• What-If tuning
![Page 313: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/313.jpg)
15-5 Copyright Oracle Corporation, 1999. All rights reserved.
Starting Oracle ExpertStart from the console using:
• The Tools menu option
• Tuning Pack tool bar icon
• Related Tools from right mouse button menu
![Page 314: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/314.jpg)
15-6 Copyright Oracle Corporation, 1999. All rights reserved.
Tuning Session Scope
• Instance parameter tuning
• Application tuning
• Database structure sizing and placement
![Page 315: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/315.jpg)
15-7 Copyright Oracle Corporation, 1999. All rights reserved.
Collecting Input Data
![Page 316: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/316.jpg)
15-8 Copyright Oracle Corporation, 1999. All rights reserved.
Collecting Data
Database Class Instance Class
![Page 317: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/317.jpg)
15-9 Copyright Oracle Corporation, 1999. All rights reserved.
Collecting Schema Class Data
![Page 318: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/318.jpg)
15-10 Copyright Oracle Corporation, 1999. All rights reserved.
Collecting DataEnvironment Class Workload Class
![Page 319: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/319.jpg)
15-11 Copyright Oracle Corporation, 1999. All rights reserved.
Viewing and Editing the Collected Data
![Page 320: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/320.jpg)
15-12 Copyright Oracle Corporation, 1999. All rights reserved.
Editing Basic Rules BeforeAnalysis
![Page 321: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/321.jpg)
15-13 Copyright Oracle Corporation, 1999. All rights reserved.
Analyzing Using Default Rules
![Page 322: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/322.jpg)
15-14 Copyright Oracle Corporation, 1999. All rights reserved.
Analyzing the Collected Data
To generate tuning suggestions:
• Select the Recommendations page
• After the Generate button is clicked:
– Stored rules are applied
– Recommendations are created
– Information is stored in repository
• Expand the required recommendations
• Analyze again if any recommendations aredeclined
![Page 323: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/323.jpg)
15-15 Copyright Oracle Corporation, 1999. All rights reserved.
Recommendations Overview
![Page 324: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/324.jpg)
15-16 Copyright Oracle Corporation, 1999. All rights reserved.
Recommendations Detail
![Page 325: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/325.jpg)
15-17 Copyright Oracle Corporation, 1999. All rights reserved.
Reports
• The Analysis report lists and explains the OracleExpert recommendations
• The Session Data report displays the collected dataand the generated statistics
• The Recommendation summary provides arecommendation overview
• The Workload Cross Reference report displays tableswith workload requests
![Page 326: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/326.jpg)
15-18 Copyright Oracle Corporation, 1999. All rights reserved.
Recommendations Implementation
File Type
.ora
.txt
Type of Recommendations
Instance
Structure
![Page 327: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/327.jpg)
15-19 Copyright Oracle Corporation, 1999. All rights reserved.
Summary
In this lesson, you should have learned how to:
• Tune Oracle databases using the Oracle Expertsystem
• Store all tuning inputs and recommendations in therepository
• View and edit the tuning rules
• Generate the analysis report for allrecommendations made by Oracle Expert
![Page 328: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/328.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
1616
Multithreaded Server Tuning Issues
![Page 329: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/329.jpg)
16-2 Copyright Oracle Corporation, 1999. All rights reserved.
Objectives
After completing this lesson, you should be able todo the following:
• Identify issues associated with managing users ina multithreaded server environment
• Diagnose and resolve performance issues withmultithreaded server processes
• Configure the multithreaded server environment tooptimize performance
![Page 330: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/330.jpg)
16-3 Copyright Oracle Corporation, 1999. All rights reserved.
Overview
System Global Area
Oracle background processes
Dispatcher processesDatabase server
Listener
Client
Sharedserverprocesses
Oracle servercode programinterface
Request queue Response queues
![Page 331: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/331.jpg)
16-4 Copyright Oracle Corporation, 1999. All rights reserved.
Multithreaded Server Characteristics
• Users can share processes
• Supports NET8i functionality
• Increases number of concurrent users
• Is most useful on:
– UNIX systems
– Other servers with remote clients
• Incurs some CPU overhead
![Page 332: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/332.jpg)
16-5 Copyright Oracle Corporation, 1999. All rights reserved.
Configuring the Multithreaded Server
• NET8i
– listener.ora
– tnsnames.ora
• MTS instance parameters:
mts_servers = 4
mts_dispatchers = “(PROTOCOL=ipc)(DISPATCHERS=4)”
mts_max_servers = 20
mts_max_dispatchers = 20
![Page 333: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/333.jpg)
16-6 Copyright Oracle Corporation, 1999. All rights reserved.
Monitoring Dispatchers
Identify contention for dispatchers by checking:
• Busy rates
• Dispatcher waiting time
SQL> SELECT network
2 "Protocol",
3 SUM(busy) / ( SUM(busy) + SUM(idle) )
4 "Total Busy Rate"
5 FROM v$dispatcher
6 GROUP BY network;
![Page 334: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/334.jpg)
16-7 Copyright Oracle Corporation, 1999. All rights reserved.
Monitoring Dispatchers
• Check for dispatcher contention
• Dynamically add or remove dispatchers
• Performance Manager predefined charts:Dispatcher and Queue
![Page 335: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/335.jpg)
16-8 Copyright Oracle Corporation, 1999. All rights reserved.
Monitoring Shared Servers
Oracle8i starts up shared servers dynamically.
• Check for shared server process contention
• Dynamically add or remove shared servers
• Use Performance Manager charts:
– Shared Server
– Queue
![Page 336: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/336.jpg)
16-9 Copyright Oracle Corporation, 1999. All rights reserved.
Monitoring Process Usage
• The V$CIRCUIT view:
– Server address
– Dispatcher address
– User session address
• Performance Manager charts: predefined chartsProcess, Circuits
![Page 337: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/337.jpg)
16-10 Copyright Oracle Corporation, 1999. All rights reserved.
Shared Servers and Memory Usage
• Some user information goes into the shared pool
• Overall memory demand should still decrease
• Shared servers use UGA for sorts
• UGA stored in large pool if configured
![Page 338: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/338.jpg)
16-11 Copyright Oracle Corporation, 1999. All rights reserved.
Possible Problems
• Net8i listener is not running.
• The MTS initialization parameters are setincorrectly.
• The dispatcher process has been terminated.
• The DBA does not have a dedicated connection.
• The PROCESSES parameter is too low.
![Page 339: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/339.jpg)
16-12 Copyright Oracle Corporation, 1999. All rights reserved.
Obtaining Dictionary Information
V$CIRCUIT
V$DISPATCHER
V$DISPATCHER_RATE
V$QUEUE
V$MTS
V$SESSION
V$SHARED_SERVER
Dynamic performance views:
![Page 340: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/340.jpg)
16-13 Copyright Oracle Corporation, 1999. All rights reserved.
Summary
In this lesson, you should have learned that:
• MTS is a resource-sharing configuration.
• MTS is not intended for batch processing ordecision support.
• MTS requires a Net8i listener.
• You can monitor dispatcher and server usage.
• The Oracle8i Server manages shared serversdynamically.
![Page 341: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/341.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.
1717
Tuning Workshop
![Page 342: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/342.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-2
Objectives
After completing this lesson, you should be able todo the following:
• Use a tuning methodology for diagnosing andresolving performance issues
• Use Oracle tools for diagnosing performanceproblems
• Tune memory structures, file I/O, and contention
![Page 343: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/343.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-3
Workshop Methodology
• Group-oriented and interactive
• Intensive hands-on diagnosis and problemresolution
• Instructor-led discussions on findings and actions
• Proactive participant involvement
![Page 344: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/344.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-4
Tuning Scope
Use Oracle tools to tune the following areas:
• Memory
• I/O
• Resource contention
![Page 345: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/345.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-5
$HOME
/LABS /DATA /TRACE
/DISK1
Simulated drivesfor database files
Workshop Configuration
/DISK2 /DISK3 /DISK4
Trace filesrefresh.sqlgrowdbflushrunprocrunusersflush.sqlrunproc.sqluser0xuser0x.sql
initbad.ora
![Page 346: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/346.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-6
Workshop Database Configuration
• One schema is created under scott/tiger.• There are six end users (user01-05, scott).• End users have access to scott’s objects.• Four tablespaces: system, rbs, user_data, temp• The DBA account is system/manager.• The sys account is sys/change_on_install.
![Page 347: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/347.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-7
Information Gathering
• Ask the instructor questions regardingperformance tuning issues as they apply to thesimulated database environment.
• Formulate questions that will enable you tofamiliarize yourself with external factors that mayaffect performance and will aid you in establishinga tuning methodology.
![Page 348: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/348.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-8
Generate Statistics
To perform a physical investigation of your workshopdatabase environment, generate statistics using:
• V$ dynamic performance views
• Data dictionary views
• Table statistics
• Various hit ratios
• utlbstat/utlestat report.txt output
![Page 349: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/349.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-9
Review Statistics
Review statistics regarding specific areas:
• Shared pool diagnostics, errors, and sizing
• Rollback segments placement, sizing, andnumbering
• Buffer cache diagnostics and sizing
• Redo log buffer contention
• Files organization, sizing, and I/O distribution
![Page 350: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/350.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-10
Review Statistics
• Segment differentiation
• Storage management issues, diagnostics, andresolution
• Row migration and chaining diagnostics andresolution
• Sort operation diagnostics and configuration
• Lock, latch, free list, and rollback segmentscontention and configuration
![Page 351: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/351.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-11
Example
Physical investigation:
• Memory structures:
– Buffer cache hit ratio low
– Library cache hit ratio low
– V$SYSSTAT
• Contention:
– Rollback segment contention
– Latch contention—>V$LATCH
![Page 352: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/352.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-12
Application Analysis
Application analysis:
• Online transaction processing separated frombatch
• Explain plan indicates no use of indexes
• High number of disk sorts
• Trace files
![Page 353: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/353.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-13
Regenerate Statistics
• Restart the instance with the new initbad.oraparameters.
• Run the refresh.sql script to simulate an instancethat has been running for some time.
• Rerun the utlbstat script.
• Run the growdb shell script.
• Rerun the utlestat script.
• Shut down the instance.
• Review the new statistics.
![Page 354: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/354.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-14
Results
• Present your conclusions and findings.
• Demonstrate the effectiveness of the tuning strategy,and what effect the changes to the instance anddatabase parameters had on overall performance.
– What was done and why?
– What were the results?
– Are there still any issues pending?
– What would you do differently?
![Page 355: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/355.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-15
Example
• Library cache hit ratio increased from 53% to 81%.
• Database buffer cache hit ratio increased from 67% to92%.
• Sorts (disk) decreased, sorts (memory) increased.
• Undo header waits decreased.
• Distribution of hot files evened out.
![Page 356: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/356.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-16
Additional Concerns
• Monitor paging and swapping using OS utilitiesbecause of larger SGA.
• Consider increasing the size of database blocks.
• Export/import to reduce fragmentation.
• Continue monitoring using utlbstat/utlestat tomeasure results against the baseline.
• Separate index segments from data segments.
![Page 357: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/357.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-17
Pending Performance Tuning Issues
• Importance of good database and application design
• Architecture configurations:
– Multithreaded server
– Parallel query
– Partitioning
• Recommendations for proactive performance tuning
![Page 358: Enterprise DBA Part 2: Performance and Tuning - Hughes · Enterprise DBA Part 2: Performance and Tuning Slides. Author Dominique Jeunot Techncali Contributors and Reviewers Bruce](https://reader031.vdocuments.site/reader031/viewer/2022021710/5c447f3193f3c34c5f80073e/html5/thumbnails/358.jpg)
Copyright Oracle Corporation, 1999. All rights reserved.17-18
Summary
In this lesson, you should have learned how to:
• Follow a tuning methodology:
1. Collect and review statistics.
2. List the objectives for enhanced performance
before modifications.
3. Modify the instance and the database.
4. Recollect and review new statistics.
5. Compare the new results with the objectives.
• Implement Oracle architectural options for enhancingperformance.