Download presentation
Presentation is loading. Please wait.
Published byLeo Walters Modified over 9 years ago
1
Oracle9i Performance Tuning Chapter 12 Tuning Tools
2
Chapter 12: Tuning Tools2 Chapter Objectives Understand and use the four basic diagnostic tools supplied with Oracle9i Use statistical tools to diagnose and tune a database Understand and use SQL tools Use data block corruption tools Use the resource management tools to regulate and distribute resource usage based on priorities
3
Chapter 12: Tuning Tools3 Tuning Tools Categories The following are the functional categories of the Oracle-provided tuning tools: Diagnostics: diagnose problems and performance issues Statistics: collect statistical data to determine the health of the database and perform trend analysis SQL: identify problematic queries Data block corruption: detect data block corruption in data files as well as database objects Analysis: gather object storage statistics Resource management: distribute CPU allocation to database users based on planned priorities
4
Chapter 12: Tuning Tools4 Diagnostic Tools – Alert Log The Alert log file is the heart-beat of the system, registering errors, events, and database activities
5
Chapter 12: Tuning Tools5 Contents of the Alert Log The types of entries that the Alert log records include: Errors Startup and Shutdown Modified Initialization Parameters Checkpoints Archiving Physical Database Changes
6
Chapter 12: Tuning Tools6 Diagnostic Tool – Background Trace Files Each time a background process fails, an error is generated to the Alert log and a trace file is generated Since these trace files are usually difficult to interpret, you should work with the Oracle Technical Support team to identify the type of problem, its cause, and action necessary to resolve the problem or prevent it from occurring again
7
Chapter 12: Tuning Tools7 Diagnostic Tools – Views
8
Chapter 12: Tuning Tools8 Diagnostic Tools – Initialization Parameters STATISTICS_LEVEL
9
Chapter 12: Tuning Tools9 Diagnostic Tools – Initialization Parameters (continued) TIMED_OS_STATISTICS: tells Oracle to collect operating system statistics for every client call to the database TIMED_STATISTICS: this parameter tells Oracle whether to collect timed statistics for each call Allowed values are TRUE or FALSE DB_CACHE_ADVICE: this parameter tells Oracle whether to collect advisory data for database caches
10
Chapter 12: Tuning Tools10 Oracle Enterprise Manager
11
Chapter 12: Tuning Tools11 Statistics Tools – UTLBSTAT/UTLESTAT
12
Chapter 12: Tuning Tools12 UTLBSTAT/UTLESTAT: report.txt The report includes statistical readings in this specific order: Library cache Sessions and users System statistics System events Wait events Latch statistics Rollback segments statistics Modified initialization parameters Data dictionary Tablespace statistics Data files statistics
13
Chapter 12: Tuning Tools13 Statistics Tool – STATSPACK The STATSPACK provides the following benefits: Ease of use: it is simple to use to gather statistics Cost: it is free with Oracle9i (requires no additional licensing fees) Historical snapshots: it captures and stores every reading in its repository for future comparisons and trend analysis Reports: it provides reports that are well organized and formatted Procedure and scripts: it provides several procedures for administering the repository of this tool Multiple databases: it supports more than one database
14
Chapter 12: Tuning Tools14 STATSPACK Architecture
15
Chapter 12: Tuning Tools15 STATSPACK Scripts
16
Chapter 12: Tuning Tools16 STATSPACK PL/SQL Stored Package The STATSPACK package is the engine of this tool This package contains the following five methods: PROCEDURE MODIFY_STATSPACK_PARAMETER: modifies the thresholds of parameters (reconfigures STATSPACK hit ratios and other parameters’ thresholds) PROCEDURE QAM_STATSPACK_PARAMETER: provides the parameter default values from the STATS$STATSPACK_PARAMETER table PROCEDURE SNAP: collects a statistics snapshot of the database; the collected statistics are stored in the repository and associated with a snapshot identification number FUNCTION SNAP RETURNS NUMBER(38): collects a statistics snapshot of the database; the collected statistics are stored in the repository and associated with a snapshot identification number, which is returned to the calling environment PROCEDURE STAT_CHANGES: used by the SPREPORT.SQL script to return differences between two statistics snapshots
17
Chapter 12: Tuning Tools17 STATSPACK – Statistic Levels STATSPACK supports several levels of statistics collection The levels are listed here with a description of the information each captures: Level 0: general statistics, including rollback segment, row cache, SGA, system events, background events, session events, system statistics, wait statistics, lock statistics, and latch information Level 5: high resource usage SQL statements, along with all data captured by lower levels Level 6: SQL plan and SQL plan usage information for high-resource usage SQL statements, along with all data captured by lower levels Level 7: segment-level statistics, including logical and physical reads, row lock, and buffer busy waits, along with all data captured by lower levels Level 10: child latch statistics, along with all data captured by lower levels
18
Chapter 12: Tuning Tools18 STATSPACK – Collecting Statistics
19
Chapter 12: Tuning Tools19 STATSPACK – Report Structure 1.Database and Instance Configuration Information 2.Database Load Information 3.Hit Ratios 4.Top 5 Events 5.Top SQL 6.System Statistics 7.Tablespace Statistics 8.File Statistics 9.Buffer Pool Statistics 10.Instance Recovery Statistics 11.Buffer Pool Advisory Statistics 12.PGA Aggregation Advisory Statistics 13.Rollback Segments Statistics 14.Latch Activity Statistics 15.Memory Statistics 16.Modified Initialization Parameter
20
Chapter 12: Tuning Tools20 SQL Tools – EXPLAIN PLAN Preparation Step: PLAN TABLE SYNONYM GRANT Execution Phase: EXPLAIN PLAN command Interpret results
21
Chapter 12: Tuning Tools21 SQL Tools – EXPLAIN PLAN (continued) Use your own SELECT statement to retrieve execution plan Use DBMS_XPLAN
22
Chapter 12: Tuning Tools22 SQL Tools – SQL*Plus AUTOTRACE Preparation Phase: PLUSTRACE role PLAN_TABLE table Synonym Execution Phase:
23
Chapter 12: Tuning Tools23 SQL Tools – SQL Trace and TKPROF
24
Chapter 12: Tuning Tools24 SQL Tools – TKPROF
25
Chapter 12: Tuning Tools25 Data Block Corruption Tools DBVERIFY: This tool performs data file verification for corruption; it can scan an entire or partial data file whether it is online or offline
26
Chapter 12: Tuning Tools26 Data Block Corruption Tools (continued) DBMS_REPAIR: detects data block corruption of database objects such as tables and indexes; it also has other uses such as marking corrupted blocks to be skipped during data fetching
27
Chapter 12: Tuning Tools27 Analyze Tools Analyze tools include: ANALYZE command DBMS_UTILITY DBMS_STATS DBMS_DDL Oracle Enterprise Manager
28
Chapter 12: Tuning Tools28 Resource Management Tool The Database Resource Manager empowers the DBA to categorize users and application proxy users who are using the database into different categories which are referred to as resource consumer groups and to allocate a percentage of CPU usage based on user priorities The Database Resource Manager provides the following benefits: Transfers the control of CPU resources from the operating system to the database and thus to the DBA Distributes CPU resources among users based on need and priority Allocates degree of parallelism to different groups based on need Prevents certain users from sporadically impacting applications that need CPU resources Allows DBAs to switch priority of CPU usage for users at any time Gives the DBA control of the amount of undo space for each consumer group
29
Chapter 12: Tuning Tools29 Resource Management Tool (continued)
30
Chapter 12: Tuning Tools30 Resource Plan
31
Chapter 12: Tuning Tools31 DBMS_RESOURCE_MANAGER Package
32
Chapter 12: Tuning Tools32 Resource Management Views
33
Chapter 12: Tuning Tools33 Resource Management Views (continued)
34
Chapter 12: Tuning Tools34Summary The Alert log file is the heart beat of the system, registering errors, events, and database activities Each time a background process fails, an error is generated to the Alert log and a trace file is generated STATSPACK was developed to replace UTLBSTAT/UTLESTAT STATSPACK is an enhanced tool for collecting statistics that help you diagnose and troubleshoot database performance The Database Resource Manager distributes CPU and other resources to users based on priorities set by the DBA
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.