Presentation is loading. Please wait.

Presentation is loading. Please wait.

Performance Management

Similar presentations


Presentation on theme: "Performance Management"— Presentation transcript:

1 Performance Management

2 Oracle Database 10g: Administration Workshop I 13-2
Objectives After completing this lesson, you should be able to do the following: Use Enterprise Manager to monitor performance Tune SQL by using the SQL Tuning Advisor Tune SQL by using the SQL Access Advisor Use Automatic Shared Memory Management (ASSM) Use the Memory Advisor to size memory buffers View performance-related dynamic views Troubleshoot invalid and unusable objects Oracle Database 10g: Administration Workshop I

3 Performance Monitoring
> Perf Mon Tuning Adv Access Adv Memory Stats Invalid Obj Performance Monitoring Memory allocation issues Input/output device contention Resource contention ? Application code problems Network bottlenecks DBA Performance Monitoring To administer Oracle Database 10g and keep it running smoothly, the database administrator (DBA) must regularly monitor its performance to locate bottlenecks and correct problem areas. There are hundreds of performance measurements the DBA can look at, covering everything from network performance and disk input/output (I/O) speed to the time spent working on individual application operations. These performance measurements are commonly referred to as database metrics. Note: For more information about Oracle database performance, see the Oracle Database 10g: SQL Tuning Workshop course. Oracle Database 10g: Administration Workshop I

4 Performance Monitoring
Performance Monitoring (continued) The Performance tabbed page in Enterprise Manager is the portal to a powerful set of performance monitoring and tuning tools. The first screen on this page summarizes processes and active session activity. The Average Active Sessions graph shows the level of CPU usage and what resources are causing the most wait events. In the screen in the slide, you see that there was a recent increase in CPU usage and waits for User I/O, System I/O, and Concurrency. You can click any one of these categories to see more details about the waits. The I/O data is broken down into types of I/O—for example, log file read, control file write, and so on. Oracle Database 10g: Administration Workshop I

5 Performance Monitoring
Performance Monitoring (continued) When you drill down to a particular wait category, you can view details of specific five-minute intervals, and also see the Top Working SQL and the Top Working Sessions associated with that particular wait event during that time. This enables you to perform after-the-fact analysis of system slowdowns, and determine potential causes. Oracle Database 10g: Administration Workshop I

6 Performance Monitoring
Performance Monitoring (continued) Instance Disk I/O and Instance Throughput are also reflected on the main Performance tabbed page. Oracle Database 10g: Administration Workshop I

7 Performance Monitoring: Top Sessions
If you click one of the I/O category names, you see the Top Consumers page, which lists the top services, modules, actions, clients, and sessions, including critical statistics such as logical and physical read and write count, parse count, and sort count. If you click an I/O category name, the associated statistic is the ordering value for the list. The table on this page lists the sessions, sorted by CPU usage. This shows that the user SH in session 152 is the greatest consumer of CPU at this particular time. Oracle Database 10g: Administration Workshop I

8 Performance Monitoring: Top Services
In multitier systems, where there is an application server that is pooling database connections, viewing sessions may not provide the information you need to analyze performance. Grouping sessions into service names enables you to monitor performance more accurately. In the example in the slide, there are three services: inventory, orcl, and hr. Regardless of what session was used for a particular request, if it connected via one of these services, then the session's performance data is captured under that service name. It is clear from this listing that, of the three application services, the inventory service was the most active during this five-minute interval. Oracle Database 10g: Administration Workshop I

9 SQL Tuning Advisor: Overview
Perf Mon > Tuning Adv Access Adv Memory Stats Invalid Obj SQL Tuning Advisor: Overview Automatic Tuning Optimizer Comprehensive SQL tuning Statistics check optimization mode Detect stale or missing statistics Plan tuning optimization mode Tune SQL plan (SQL profile) Access analysis optimization mode Add missing index Run access advisor SQL Tuning Advisor: Overview The SQL Tuning Advisor is the primary driver of the tuning process. It calls the Automatic Tuning Optimizer (ATO) to perform four specific types of analyses: Statistics Analysis: The Automatic Tuning Optimizer checks each query object for missing or stale statistics, and makes recommendations to gather relevant statistics. SQL Profiling: The ATO verifies its own estimates and collects auxiliary information to remove estimation errors. It builds a SQL profile using the auxiliary information and makes a recommendation to create it. When a SQL profile is created, it enables the query optimizer to generate a well-tuned plan. Access Path Analysis: The ATO explores whether a new index can be used to significantly improve access to each table in the query and, when appropriate, makes recommendations to create such indexes. SQL Structure Analysis: The ATO tries to identify SQL statements that use bad plans and makes relevant suggestions to restructure them. The suggested changes can be syntactic as well as semantic. SQL Tuning Advisor SQL analysis optimization mode Restructure SQL Oracle Database 10g: Administration Workshop I

10 SQL Tuning Advisor Options and Recommendations
After the SQL Tuning Advisor is launched, Enterprise Manager automatically creates a tuning task, provided that the user has appropriate ADVISOR privileges to do so. Enterprise Manager shows the tuning task and automatic default options on the SQL Tuning Options page. On this page, the user can change the automatic defaults for a tuning task. It is important to choose the appropriate scope for the tuning task If you choose the Limited option, then the SQL Tuning Advisor produces recommendations based on statistics check, access path analysis, and SQL structure analysis. No SQL profile recommendation is generated with the Limited option. If you choose the Comprehensive option, the SQL Tuning Advisor produces all the recommendations that the Limited option produces, but it also invokes the optimizer under the SQL profiling mode to build a SQL profile, if applicable. With the Comprehensive option, you can also specify a time limit for the tuning task, which by default is 60 minutes. After you select Run SQL Tuning Advisor, configure your tuning task using the SQL Tuning Options page. Go back to the Top SQL page and click the tuned statement to go to the SQL Details page on which the Recommendations history is displayed. The Recommendations history shows you the completed tuning task. Click the task to see its general recommendation information. Click View Recommendations to see the details about the task . Oracle Database 10g: Administration Workshop I

11 Using the SQL Tuning Advisor
Use the SQL Tuning Advisor to analyze SQL statements and obtain performance recommendations. Sources for SQL Tuning Advisor to analyze Top SQL: Analyzes the top SQL statements currently active SQL Tuning Sets: Analyzes a set of SQL statements you provide Snapshots: Analyzes a snapshot Baselines: Analyzes a baseline Using the SQL Tuning Advisor You can use the SQL Tuning Advisor to analyze SQL statements and obtain performance recommendations. Typically, you run this advisor as an ADDM performance–finding action. Additionally, you can run the SQL Tuning Advisor when you want to analyze the Top SQL statements consuming the most CPU time, I/O, and memory. Oracle Database 10g: Administration Workshop I

12 Using the SQL Tuning Advisor: Example
You can invoke the SQL Tuning Advisor by performing the following steps: 1. Click Advisor Central in the Related Links region on the Database home page. 2. Click SQL Tuning Advisor. The SQL Tuning Advisor Links page appears. The advisor can be run on one of the following sources: Top SQL: Analyzes the Top SQL statements currently active SQL Tuning Sets: Analyzes a set of SQL statements you provide Snapshots: Analyzes a snapshot Baselines: Analyzes a baseline 3. Select Top SQL. Select a five-minute interval to analyze by dragging the shaded box over the target time period. Select one or more statements to analyze during the selected period. 4. Click Run SQL Tuning Advisor. The SQL Tuning Options page appears showing the SQL statements in the interval. Give your task a name and description, select Comprehensive as the scope, and select Immediately for start time. Click OK. 5. Navigate back to the Advisor Central page. The status of Advisor Tasks is listed under this heading in the results region. Wait until your task status is completed. Check the status by clicking Refresh in your browser. Select your task and click View Result. The SQL Tuning Result page appears. 6. Select the SQL statement and click View Recommendations. Oracle Database 10g: Administration Workshop I

13 SQL Tuning Advisor: SQL Statistics
select count(*) from x where object_id < 340 select count(*) from x where object_id < 220 Each statement causes a hard parse. SQL Statistics The SQL Tuning Advisor also shows you the statistics for a cursor that represents a SQL statement. By viewing statistics for each of these two cursors, you can see that each of them causes a hard parse of the statement. This means that the statement is not found to be a match in the Library Cache. This is because of the use of literals instead of bind variables. Oracle Database 10g: Administration Workshop I

14 SQL Tuning Advisor: Identifying Duplicate SQL
Bind variable candidates Identifying Duplicate SQL Duplicate SQL can be identified by clicking Duplicate SQL on the Performance tabbed page. SQL that is determined to be duplicate, except for formatting or literal differences, is listed together. This helps you determine which SQL in your application can be consolidated, thus lowering the requirements on the Library Cache and speeding up the execution of the statement. Oracle Database 10g: Administration Workshop I

15 Using the SQL Access Advisor
Perf Mon Tuning Adv > Access Adv Memory Stats Invalid Obj Using the SQL Access Advisor Using the SQL Access Advisor You can use the SQL Access Advisor to tune your schema and improve your query performance. This advisor requires that you identify a SQL workload, which is a representative set of SQL statements that access the schema. You can select your workload from different sources including current and recent SQL activity, a SQL repository, or a user-defined workload such as from a development environment. The SQL Access Advisor may make recommendations such as creating indexes or materialized views to improve your query performance for the given workload. You can invoke the SQL Access Advisor by performing the following steps: 1. Click Advisor Central in the Related Links region on the Database home page. 2. Click SQL Access to begin a wizard. The SQL Access Advisor: Workload Source page appears. 3. Specify your workload source and click Next. The SQL Access Advisor: Recommendation Options page appears. 4. Specify whether you want the advisor to recommend indexes, materialized views, or both. 5. Specify limited or comprehensive mode. Limited mode runs faster by concentrating on highest cost statements. Oracle Database 10g: Administration Workshop I

16 Managing Memory Components
Perf Mon Tuning Adv Access Adv > Memory Stats Invalid Obj Managing Memory Components Automatic Shared Memory Management: Is recommended to simplify management Enables you to specify the total SGA memory through one initialization parameter Enables the Oracle server to manage the amount of memory allocated to the shared pool, Java pool, buffer cache, streams pool, and the large pool Manually setting shared memory management: Sizes the components through multiple individual initialization parameters Uses the Memory Advisor to make recommendations Managing Memory Components The SGA comprises several components. The size of many of these components can be managed by the Oracle server through the use of the Automatic Shared Memory Management (ASMM) feature. This simplifies your memory management tasks. Alternatively, you can manage the size of the components manually by setting other multiple initialization parameters. If, at a later time, the Oracle server notifies you of a performance problem that is related to the size of the Shared Global Area (SGA) or Program Global Area (PGA), you can use the Memory Advisor to determine appropriate new settings. The Memory Advisor can model the effect of parameter changes. You can also specify that the Oracle server must automatically tune the important memory parameters as conditions change. Automatic tuning is recommended. Oracle Database 10g: Administration Workshop I

17 Enabling Automatic Shared Memory Management (ASMM)
Click Enable to enable Automatic Shared Memory Management. Enabling Automatic Shared Memory Management If you have not enabled this feature when you configured your database, you can enable it by performing the following steps: 1. Click Memory Parameters in the Instance region of the Administration page. 2. Click Enable. The Enable Automatic Shared Memory Management page appears. 3. Specify the total SGA size. Click OK. You can increase the total SGA size at a later time by increasing the value of the SGA_TARGET initialization parameter, but you cannot set it higher than the value specified by the SGA_MAX_SIZE parameter. For more information, refer to the Oracle Database Administrator’s Guide. Note: Oracle recommends that you use Automatic Shared Memory Management to simplify your memory management tasks. Oracle Database 10g: Administration Workshop I

18 Manually Setting Shared Memory Management
If you do not use Automatic Shared Memory Management, you must provide values for each component of the SGA on installation and database creation. Perform the following: 1. Access the Memory Parameters page by clicking the Memory Parameters link in the Database Configuration region of the Administration page. 2. Invoke any of the memory advisors by clicking Advice. 3. Click Help to view the online Help for additional information about how the Memory Advisor works. Oracle Database 10g: Administration Workshop I

19 Using the Memory Advisor
The Memory Advisor helps you tune the size of your memory structures. You can use this advisor only when automatic memory tuning is disabled. The Memory Advisor comprises three advisors that give you recommendations on the following memory structures: Shared pool in the System Global Area (SGA) Buffer cache in the SGA Program Global Area (PGA) You can invoke the Memory Advisors by performing the following steps: 1. Click Advisor Central in the Related Links region on the Database home page. 2. Click Memory Advisor on the Advisor Central page. The Memory Parameters page appears. This page provides a breakdown of memory usage for the SGA. Note: The Automatic Shared Memory Management setting should be disabled in order to run the advisor. 3. Click Advice next to the Shared Pool value or Buffer Cache value to invoke the respective advisors. 4. Click PGA to access the PGA property page. Click Advice to invoke the PGA Advisor. Oracle Database 10g: Administration Workshop I

20 Dynamic Performance Statistics
Access Adv Memory > Stats Invalid Obj Dynamic Performance Statistics Systemwide Session specific Service specific V$SYSSTAT statistic# name class value stat_id V$SESSTAT sid statistic# value V$SERVICE_STATS service_name_hash service_name stat_id stat_name value V$SERVICE_EVENT service_name service_name_hash event event_id total_waits total_timeouts time_waited average_wait time_waited_micro V$SYSTEM_EVENT event total_waits total_timeouts time_waited average_wait time_waited_micro V$SESSION_EVENT sid event total_waits total_timeouts time_waited average_wait max_wait time_waited_micro event_id Dynamic Performance Statistics To effectively diagnose performance problems, statistics must be available. Oracle generates many types of statistics for different levels of granularity. At the systemwide level, the session level, and the service level, both wait events and accumulated statistics are computed. The top row of views are the cumulative statistics. The bottom row is made up of the wait event views. When analyzing a performance problem in any of these scopes, you typically look at the change in statistics (delta value) over the period of time you are interested in. All the possible wait events are cataloged in the V$EVENT_NAME view. All statistics are cataloged in the V$STATNAME view; about 360 statistics are available in Oracle database. Cumulative stats Wait events Oracle Database 10g: Administration Workshop I

21 Troubleshooting and Tuning Views
Instance/Database V$DATABASE V$INSTANCE V$PARAMETER V$SPPARAMETER V$SYSTEM_PARAMETER V$PROCESS V$BGPROCESS V$PX_PROCESS_SYSSTAT V$SYSTEM_EVENT Disk V$DATAFILE V$FILESTAT V$LOG V$LOG_HISTORY V$DBFILE V$TEMPFILE V$TEMPSEG_USAGE V$SEGMENT_STATISTICS Contention V$LOCK V$UNDOSTAT V$WAITSTAT V$LATCH Memory V$BUFFER_POOL_STATISTICS V$LIBRARYCACHE V$SGAINFO V$PGASTAT Troubleshooting and Tuning Views The slide lists some of the views that you may access to determine the cause of performance problems or analyze the current status of your database. For a complete description of these views, refer to the Oracle Database Reference Manual. Oracle Database 10g: Administration Workshop I

22 Invalid and Unusable Objects
Perf Mon Tuning Adv Access Adv Memory Stats > Invalid Obj Invalid and Unusable Objects Effect on Performance: PL/SQL code objects are recompiled. Indexes are rebuilt. Invalid and Unusable Objects The current status of certain database objects can be viewed by querying the data dictionary, which is described in the lesson titled “Managing Schema Objects.” If you find PL/SQL objects with a status of INVALID, the first question that you need to answer is “Has this object ever been VALID?” Often, an application developer neglects to clean up code that does not work. If the PL/SQL object is invalid because of a code error, then there is little that can be done until that error is fixed. If the procedure was valid at sometime in the past and has recently become invalid, you have two options to fix the problem: Do nothing. Most PL/SQL objects automatically recompile if needed when they are called. Users experience a slight delay while the objects recompile. (In most cases, this delay is not even noticeable.) Manually recompile the invalid object. Invalid PL/SQL objects can be manually recompiled by using Enterprise Manager or through SQL commands: ALTER PROCEDURE HR.add_job_history COMPILE; Manually recompiling PL/SQL packages requires two steps: ALTER PACKAGE HR.maintainemp COMPILE; ALTER PACKAGE HR.maintainemp COMPILE BODY; Oracle Database 10g: Administration Workshop I

23 Oracle Database 10g: Administration Workshop I 13-27
Summary In this lesson, you should have learned how to: Use Enterprise Manager to monitor performance Tune SQL using the SQL Tuning Advisor Tune SQL using the SQL Access Advisor Use Automatic Shared Memory Management Use the Memory Advisor to size memory buffers View performance-related dynamic views Troubleshoot invalid and unusable objects Oracle Database 10g: Administration Workshop I

24 Practice Overview: Monitoring and Improving Performance
This practice covers the following topics: Detecting and repairing unusable indexes Using the SQL Tuning Advisor Using the Performance page in Enterprise Manager Oracle Database 10g: Administration Workshop I


Download ppt "Performance Management"

Similar presentations


Ads by Google