Upload
yairr
View
219
Download
0
Embed Size (px)
Citation preview
8/14/2019 Less13 Performance Tb
1/40
13Copyright 2005, Oracle. All rights reserved.
Monitoring and Improving Performance
8/14/2019 Less13 Performance Tb
2/40
13-2 Copyright 2005, Oracle. All rights reserved.
Objectives
After completing this lesson, you should be able to do
the following:
Troubleshoot invalid and unusable objects
Gather optimizer statistics View performance metrics
Deal with performance issues
8/14/2019 Less13 Performance Tb
3/40
8/14/2019 Less13 Performance Tb
4/40
13-4 Copyright 2005, Oracle. All rights reserved.
Monitoring Methodologies
Reactive
Proactive:
Server-generated alerts
Automatic Database Diagnostic Monitor (ADDM)
8/14/2019 Less13 Performance Tb
5/40
13-5 Copyright 2005, Oracle. All rights reserved.
Database and Instance Metrics
Several performance statistics are available through:
Data dictionary
Dynamic performance views
Optimizer statistics
DBA
8/14/2019 Less13 Performance Tb
6/40
13-6 Copyright 2005, Oracle. All rights reserved.
Database and Instance Metrics
Full Notes Page
8/14/2019 Less13 Performance Tb
7/4013-7 Copyright 2005, Oracle. All rights reserved.
Data Dictionary Metrics
You can view the status of:
PL/SQL code objects
Indexes
8/14/2019 Less13 Performance Tb
8/4013-8 Copyright 2005, Oracle. All rights reserved.
Invalid and Unusable Objects
PL/SQL code objects are recompiled.
Indexes are rebuilt.
8/14/2019 Less13 Performance Tb
9/4013-9 Copyright 2005, Oracle. All rights reserved.
Invalid and Unusable Objects
Full Notes Page
8/14/2019 Less13 Performance Tb
10/4013-10 Copyright 2005, Oracle. All rights reserved.
Optimizer Statistics
Optimizer statistics are:
Not real time
Persistent across instance restarts
Collected automatically
SQL> SELECT COUNT(*) FROM hr.employees;
COUNT(*)
----------
214
SQL> SELECT num_rows FROM dba_tables2WHERE owner='HR'ANDtable_name='EMPLOYEES';
NUM_ROWS
----------
107
8/14/2019 Less13 Performance Tb
11/4013-11 Copyright 2005, Oracle. All rights reserved.
Optimizer Statistics
Full Notes Page
8/14/2019 Less13 Performance Tb
12/4013-12 Copyright 2005, Oracle. All rights reserved.
Using the Manage Optimizer
Statistics Page
8/14/2019 Less13 Performance Tb
13/4013-13 Copyright 2005, Oracle. All rights reserved.
Manage Optimizer Statistics Page
Full Notes Page
8/14/2019 Less13 Performance Tb
14/4013-14 Copyright 2005, Oracle. All rights reserved.
Manually Gathering Optimizer Statistics
8/14/2019 Less13 Performance Tb
15/4013-15 Copyright 2005, Oracle. All rights reserved.
Dynamic Performance Views
Dynamic Performance views are:
Real time
Nonpersistent across instance restarts
SQL> SELECT name, value FROM v$sysstat
2 WHERE name='sorts (memory)' ORDER BY name;
NAME VALUE
--------------- ----------
sorts (memory) 1979183
SQL> /
NAME VALUE
--------------- ----------
sorts (memory) 1979184
8/14/2019 Less13 Performance Tb
16/4013-16 Copyright 2005, Oracle. All rights reserved.
Viewing Metric Information
1. Use the All Metrics link in the
Related Links region.
2. Drill down for in-depth
analysis.
8/14/2019 Less13 Performance Tb
17/4013-17 Copyright 2005, Oracle. All rights reserved.
Reacting to Performance Issues
Use Enterprise Manager to:
Find key performance issues
Drill down to the root cause
8/14/2019 Less13 Performance Tb
18/4013-18 Copyright 2005, Oracle. All rights reserved.
Reacting to Performance Issues
Drill down to performance measurements to identify
bottlenecks.
CPU user: A specific update statement
8/14/2019 Less13 Performance Tb
19/4013-19 Copyright 2005, Oracle. All rights reserved.
Tuning Tips
Considerations:
There are some general guidelines that serve as a
starting point in performance tuning.
Your situation may not fit the guideline. Test any changes under a representative
production environment to see the effects.
There are written volumes and multiday classes
dedicated to tuning an Oracle database.
8/14/2019 Less13 Performance Tb
20/4013-20 Copyright 2005, Oracle. All rights reserved.
Tuning Activities
The three activities in performance management are:
Performance planning
Instance tuning
SQL tuning
8/14/2019 Less13 Performance Tb
21/4013-21 Copyright 2005, Oracle. All rights reserved.
Performance Planning
Investment options
System architecture
Scalability
Application design principles Workload testing, modeling, and implementation
Deploying new applications
8/14/2019 Less13 Performance Tb
22/4013-22 Copyright 2005, Oracle. All rights reserved.
Performance Planning
Full Notes Page
8/14/2019 Less13 Performance Tb
23/4013-23 Copyright 2005, Oracle. All rights reserved.
Instance Tuning
Have well-defined goals.
Allocate memory to database structures.
Consider I/O requirements in each part of the
database. Tune the operating system for optimal
performance of the database.
8/14/2019 Less13 Performance Tb
24/4013-24 Copyright 2005, Oracle. All rights reserved.
Tuning Memory Allocation
Java pool
Database
buffer cache
Redo log
buffer
Shared pool
Large pool
SGA
Fixed SGA
Streams pool
What is the optimal allocation?
SGA_TARGET = 8G
STATISTICS_LEVEL = TYPICAL
8/14/2019 Less13 Performance Tb
25/4013-25 Copyright 2005, Oracle. All rights reserved.
Tuning Memory Allocation
Full Notes Page
8/14/2019 Less13 Performance Tb
26/40
13-26 Copyright 2005, Oracle. All rights reserved.
Memory Tuning: Guidelines
Try to fit the SGA into physical memory.
Tune for a high buffer cache hit ratio, with the
following caveats:
Even valid and necessary full table scans lower it. It is possible that unnecessary repeated reads of
the same blocks are artificially raising it.
Use the Memory Advisor.
8/14/2019 Less13 Performance Tb
27/40
13-27 Copyright 2005, Oracle. All rights reserved.
Memory Tuning Guidelines
Full Notes Page
8/14/2019 Less13 Performance Tb
28/40
13-28 Copyright 2005, Oracle. All rights reserved.
Memory Tuning Guidelines
for the Library Cache
Establish formatting conventions for developers
so that SQL statements match in the cache.
Use bind variables.
Eliminate unnecessary duplicate SQL. Consider using CURSOR_SHARING.
Use PL/SQL when possible.
Cache sequence numbers.
Pin objects in the library cache.
8/14/2019 Less13 Performance Tb
29/40
13-29 Copyright 2005, Oracle. All rights reserved.
Memory Tuning Guidelines
for the Library Cache
Full Notes Page
8/14/2019 Less13 Performance Tb
30/40
13-30 Copyright 2005, Oracle. All rights reserved.
Tuning I/O
Look for hot spots on the disk.
Ensure that you have right-sized redo log files.
Consider moving redo logs to separate disks.
Consider moving archive logs to separate disks. Look for a high I/O rate on the TEMP tablespace.
Reduce contention for high I/O data files by
segregating them.
Consider striping all data across all disks. Consider using Automatic Storage Management.
8/14/2019 Less13 Performance Tb
31/40
13-31 Copyright 2005, Oracle. All rights reserved.
Tuning I/O
Full Notes Page
8/14/2019 Less13 Performance Tb
32/40
13-32 Copyright 2005, Oracle. All rights reserved.
Tuning SQL
Using the SQL Tuning Advisor
Using indexes and clusters
Using optimizer hints
UsingV$SQL_PLAN and EXPLAINPLAN
8/14/2019 Less13 Performance Tb
33/40
13-33 Copyright 2005, Oracle. All rights reserved.
Tuning SQL
Full Notes Page
8/14/2019 Less13 Performance Tb
34/40
13-34 Copyright 2005, Oracle. All rights reserved.
Tuning Recommendations
8/14/2019 Less13 Performance Tb
35/40
13-35 Copyright 2005, Oracle. All rights reserved.
Recommendation Plan
8/14/2019 Less13 Performance Tb
36/40
13-36 Copyright 2005, Oracle. All rights reserved.
SQL Statistics
select count(*) fromxwhere object_id < 340
select count(*) fromxwhere object_id < 220
Each statement causes a hard parse.
8/14/2019 Less13 Performance Tb
37/40
13-37 Copyright 2005, Oracle. All rights reserved.
Identifying Duplicate SQL
Bind variable
candidates
8/14/2019 Less13 Performance Tb
38/40
13-38 Copyright 2005, Oracle. All rights reserved.
Summary
In this lesson, you should have learned how to:
Troubleshoot invalid and unusable objects
Gather optimizer statistics
View performance metrics Deal with performance issues
Describe some basic tuning steps
8/14/2019 Less13 Performance Tb
39/40
13-39 Copyright 2005, Oracle. All rights reserved.
Practice Overview:
Monitoring and Improving Performance
This practice covers the following topics:
Detecting and repairing unusable indexes
Using EXPLAIN PLAN
Gathering statistics Using the Performance page in Enterprise
Manager
8/14/2019 Less13 Performance Tb
40/40
Full Notes Page