搜尋
首頁資料庫mysql教程通过案例学调优之--OracleADDM

通过案例学调优之--Oracle ADDM 应用环境: 操作系统: RedHat EL55 Oracle: Oracle 10gR2 一、ADDM简介 在Oracle9i及之前,DBA们已经拥有了很多很好用的性能分析工具,比如,tkprof、sql_trace、statspack、set event 1004610053等等。这些工具能够帮助DBA

通过案例学调优之--Oracle ADDM

应用环境:

操作系统: RedHat EL55

Oracle:   Oracle 10gR2

一、ADDM简介  
        在Oracle9i及之前,DBA们已经拥有了很多很好用的性能分析工具,比如,tkprof、sql_trace、statspack、set event 10046&10053等等。这些工具能够帮助DBA很快的定位性能问题。但这些工具都只给出一些统计数据,然后再由DBA们根据自己的经验进行优化。
        那能不能由机器自动在统计数据的基础上给出优化建议呢?Oracle10g中就推出了新的优化诊断工具:数据库自动诊断监视工具(Automatic Database Diagnostic Monitor ADDM)和SQL优化建议工具(SQL Tuning Advisor STA)。这两个工具的结合使用,能使DBA节省大量优化时间,也大大减少了系统宕机的危险。简单点说,ADDM就是收集相关的统计数据到自动工作量知识库(Automatic Workload Repository AWR)中,而STA则根据这些数据,给出优化建议。例如,一个系统资源紧张,出现了明显的性能问题,由以往的办法,做个一个statspack快照,等30分钟,再做一次。查看报告,发现’ db file scattered read’事件在top 5 events里面。根据经验,这个事件一般可能是因为缺少索引、统计分析信息不够新、热表都放在一个数据文件上导致IO争用等原因引起的。根据这些经验,我们需要逐个来定位排除,比如查看语句的查询计划、查看user_tables的last_analysed子段,检查热块等等步骤来最后定位出原因,并给出优化建议。但是,有了STA以后,它就可以根据ADDM采集到的数据直接给出优化建议,甚至给出优化后的语句(抢了DBA的饭碗喽)。

wKiom1ShCLDjoH6jAAJty698fHM826.jpg        ADDM能发现定位的问题包括:

        操作系统内存页入页出问题
        由于Oracle负载和非Oracle负载导致的CPU瓶颈问题
        导致不同资源负载的Top SQL语句和对象——CPU消耗、IO带宽占用、潜在IO问题、RAC内部通讯繁忙 
        按照PLSQL和JAVA执行时间排的Top SQL语句. 
        过多地连接 (login/logoff). 
        过多硬解析问题——由于shared pool过小、书写问题、绑定大小不适应、解析失败原因引起的。 
        过多软解析问题
        索引查询过多导致资源争用. 
        由于用户锁导致的过多的等待时间 (通过包dbms_lock加的锁)
        由于DML锁导致的过多等待时间(例如锁住表了) 
        由于管道输出导致的过多等待时间(如通过包dbms_pipe.put进行管道输出) 
        由于并发更新同一个记录导致的过多等待时间(行级锁等待) 
        由于ITL不够导致的过多等待时间(大量的事务操作同一个数据块)
        系统中过多的commit和rollback(logfile sync事件).
        由于磁盘带宽太小和其他潜在问题(如由于logfile太小导致过多的checkpoint,MTTR设置问题,过多的undo操作等等)导致的IO性能问题I 
        对于DBWR进程写数据块,磁盘IO吞吐量不足 
        由于归档进程无法跟上redo日至产生的速度,导致系统变慢 
        redo数据文件太小导致的问题
        由于扩展磁盘分配导致的争用
        由于移动一个对象的高水位导致的争用问题 
        内存太小问题——SGA Target, PGA, Buffer Cache, Shared Pool 
        在一个实例或者一个机群环境中存在频繁读写争用的热块 
        在一个实例或者一个机群环境中存在频繁读写争用的热对象 
        RAC环境中内部通讯问题 
        LMS进程无法跟上导致锁请求阻塞 
        在RAC环境中由于阻塞和争用导致的实例倾斜 
        RMAN导致的IO和CPU问题
        Streams和AQ问题
        资源管理等待事件

        有一点要记住:AWR收集的数据时放到内存中(share pool),通过一个新的后台进程MMON定期写到磁盘中。所以10g的share pool要求比以前版本更大,一般推荐比以前大15-20%。另外,还要求系统参数STATISTICS_LEVEL设置为TYPICAL(推荐)或ALL;
ALTER SESSION SET STATISTICS_LEVEL= TYPICAL;

二、案例:

1、采集AWR Snapshot

SQL> begin
  2   dbms_workload_repository.create_snapshot('TYPICAL');
  3  end;
  4  /

2、运行事务

scott用户执行一个资源消耗高的事务:

15:14:47 SCOTT@ prod>begin
15:34:41   2    for i in 1..1000000 loop
15:34:41   3    execute immediate 'insert into scott.t1 values ('||i||')';
15:34:41   4    end loop;
15:34:41   5    end;
15:34:41   6    /

tom用户同时执行一个资源消耗高的事务:

15:34:45 TOM@ prod>begin
15:34:49   2    for i in 1..1000000 loop
15:34:49   3    execute immediate 'insert into scott.t1 values ('||i||')';
15:34:49   4    end loop;
15:34:49   5    end;
15:34:49   6    /

3、再次采集AWR Snapshot

SQL> begin
  2   dbms_workload_repository.create_snapshot('TYPICAL');
  3  end;
  4  /

4、查询生成的快照

15:37:57 SYS@ prod> select snap_id,begin_interval_time,end_interval_time from dba_hist_snapshot order by snap_id asc
    
       190 15-AUG-14 03.18.34.663 PM                15-AUG-14 03.36.36.686 PM
       191 15-AUG-14 03.36.36.686 PM                15-AUG-14 03.37.18.352 PM
       192 15-AUG-14 03.37.18.352 PM                15-AUG-14 03.40.17.649 PM
       193 15-AUG-14 03.40.17.649 PM                15-AUG-14 03.42.38.632 PM
12 rows selected.


5、创建优化任务并执行

15:51:01 SYS@ prod>DECLARE
15:51:57   2      task_name VARCHAR2(30) := 'DEMO_ADDM03';
15:51:57   3      task_desc VARCHAR2(30) := 'ADDM Feature Test';
15:51:57   4      task_id NUMBER;
15:51:57   5  BEGIN
15:51:57   6      dbms_advisor.create_task('ADDM', task_id, task_name, task_desc, null);
15:51:57   7      dbms_advisor.set_task_parameter(task_name, 'START_SNAPSHOT', 192);
15:51:57   8      dbms_advisor.set_task_parameter(task_name, 'END_SNAPSHOT', 193);
15:51:58   9      dbms_advisor.set_task_parameter(task_name, 'INSTANCE', 1);
15:51:58  10      dbms_advisor.set_task_parameter(task_name, 'DB_ID', 199802235);
15:51:58  11      dbms_advisor.execute_task(task_name);
15:51:58  12  END;
15:51:59  13  /
PL/SQL procedure successfully completed.

    其中,set_task_parameter是用来设置任务参数的。START_SNAPSHOT是起始快照ID,END_SNAPSHOT是结束快照ID,INSTANCE是实例号,对于单实例,一般是1,在RAC环境下,可以通过查询视图v$instance得到,DB_ID是数据库的唯一识别号,可以通过查询v$database查到。


6、查看优化建议结果

15:53:18 SYS@ prod>SELECT dbms_advisor.get_task_report('DEMO_ADDM03','TEXT', 'ALL') FROM DUAL;
          DETAILED ADDM REPORT FOR TASK 'DEMO_ADDM03' WITH ID 1012
          --------------------------------------------------------
              Analysis Period: 15-AUG-2014 from 15:40:18 to 15:42:39
         Database ID/Instance: 199802235/1
      Database/Instance Names: PROD/prod
                    Host Name: rh55
             Database Version: 10.2.0.1.0
               Snapshot Range: from 192 to 193
                Database Time: 305 seconds
        Average Database Load: 2.2 active sessions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FINDING 1: 100% impact (305 seconds)
------------------------------------
Host CPU was a bottleneck and the instance was consuming 88% of the host CPU.
All wait times will be inflated by wait for CPU.
   RECOMMENDATION 1: Host Configuration, 100% benefit (305 seconds)
      ACTION: Consider adding more CPUs to the host or adding instances
         serving the database on other hosts.
      ACTION: Also consider using Oracle Database Resource Manager to
         prioritize the workload from various consumer groups.
   RECOMMENDATION 2: Application Analysis, 33% benefit (101 seconds)
      ACTION: Parsing SQL statements were consuming significant CPU. Please
         refer to other findings in this task about parsing for further
         details.
   ADDITIONAL INFORMATION:
      Host CPU consumption was 100%.  CPU runqueue statistics are not
      available from the host's OS. This disables ADDM's ability to estimate
      the impact of this finding.  The instance spent significant time on CPU.
      However, there were no predominant SQL statements responsible for the
      CPU load.
FINDING 2: 96% impact (294 seconds)
-----------------------------------
SQL statements consuming significant database time were found.
   RECOMMENDATION 1: SQL Tuning, 92% benefit (280 seconds)
      ACTION: Tune the PL/SQL block with SQL_ID "0d4kcvj32z62p". Refer to the
         "Tuning PL/SQL Applications" chapter of Oracle's "PL/SQL User's Guide
         and Reference"
         RELEVANT OBJECT: SQL statement with SQL_ID 0d4kcvj32z62p
         begin
         for i in 1..1000000 loop
         execute immediate 'insert into scott.t1 values ('||i||')';
         end loop;
         end;
   RECOMMENDATION 2: SQL Tuning, 2.5% benefit (8 seconds)
      ACTION: Investigate the SQL statement with SQL_ID "7ng34ruy5awxq" for
         possible performance improvements.
         RELEVANT OBJECT: SQL statement with SQL_ID 7ng34ruy5awxq and
         PLAN_HASH 3992920156
         select i.obj#,i.ts#,i.file#,i.block#,i.intcols,i.type#,i.flags,i.prop
         erty,i.pctfree$,i.initrans,i.maxtrans,i.blevel,i.leafcnt,i.distkey,i.
         lblkkey,i.dblkkey,i.clufac,i.cols,i.analyzetime,i.samplesize,i.dataob
         j#,nvl(i.degree,1),nvl(i.instances,1),i.rowcnt,mod(i.pctthres$,256),i
         .indmethod#,i.trunccnt,nvl(c.unicols,0),nvl(c.deferrable#+c.valid#,0)
         ,nvl(i.spare1,i.intcols),i.spare4,i.spare2,i.spare6,decode(i.pctthres
         $,null,null,mod(trunc(i.pctthres$/256),256)),ist.cachedblk,ist.cacheh
         it,ist.logicalread from ind$ i, ind_stats$ ist, (select enabled,
         min(cols) unicols,min(to_number(bitand(defer,1)))
         deferrable#,min(to_number(bitand(defer,4))) valid# from cdef$ where
         obj#=:1 and enabled > 1 group by enabled) c where i.obj#=c.enabled(+)
         and i.obj# = ist.obj#(+) and i.bo#=:1 order by i.obj#
      RATIONALE: SQL statement with SQL_ID "7ng34ruy5awxq" was executed 596
         times and had an average elapsed time of 0.012 seconds.
   RECOMMENDATION 3: SQL Tuning, 2.1% benefit (6 seconds)
      ACTION: Investigate the SQL statement with SQL_ID "0k8522rmdzg4k" for
         possible performance improvements.
         RELEVANT OBJECT: SQL statement with SQL_ID 0k8522rmdzg4k and
         PLAN_HASH 2057665657
         select privilege# from sysauth$ where (grantee#=:1 or grantee#=1) and
         privilege#>0
   RECOMMENDATION 4: SQL Tuning, 2% benefit (6 seconds)
      ACTION: Use bigger fetch arrays while fetching results from the SELECT
         statement with SQL_ID "7ng34ruy5awxq".
         RELEVANT OBJECT: SQL statement with SQL_ID 7ng34ruy5awxq and
         PLAN_HASH 3992920156
         select i.obj#,i.ts#,i.file#,i.block#,i.intcols,i.type#,i.flags,i.prop
         erty,i.pctfree$,i.initrans,i.maxtrans,i.blevel,i.leafcnt,i.distkey,i.
         lblkkey,i.dblkkey,i.clufac,i.cols,i.analyzetime,i.samplesize,i.dataob
         j#,nvl(i.degree,1),nvl(i.instances,1),i.rowcnt,mod(i.pctthres$,256),i
         .indmethod#,i.trunccnt,nvl(c.unicols,0),nvl(c.deferrable#+c.valid#,0)
         ,nvl(i.spare1,i.intcols),i.spare4,i.spare2,i.spare6,decode(i.pctthres
         $,null,null,mod(trunc(i.pctthres$/256),256)),ist.cachedblk,ist.cacheh
         it,ist.logicalread from ind$ i, ind_stats$ ist, (select enabled,
         min(cols) unicols,min(to_number(bitand(defer,1)))
         deferrable#,min(to_number(bitand(defer,4))) valid# from cdef$ where
         obj#=:1 and enabled > 1 group by enabled) c where i.obj#=c.enabled(+)
         and i.obj# = ist.obj#(+) and i.bo#=:1 order by i.obj#
FINDING 3: 49% impact (149 seconds)
-----------------------------------
Soft parsing of SQL statements was consuming significant database time.
   RECOMMENDATION 1: Application Analysis, 49% benefit (149 seconds)
      ACTION: Investigate application logic to keep open the frequently used
         cursors. Note that cursors are closed by both cursor close calls and
         session disconnects.
   RECOMMENDATION 2: DB Configuration, 49% benefit (149 seconds)
      ACTION: Consider increasing the maximum number of open cursors a session
         can have by increasing the value of parameter "open_cursors".
      ACTION: Consider increasing the session cursor cache size by increasing
         the value of parameter "session_cached_cursors".
      RATIONALE: The value of parameter "open_cursors" was "300" during the
         analysis period.
      RATIONALE: The value of parameter "session_cached_cursors" was "20"
         during the analysis period.
   SYMPTOMS THAT LED TO THE FINDING:
      SYMPTOM: Contention for latches related to the shared pool was consuming
               significant database time. (12% impact [36 seconds])
         INFO: Waits for "latch: library cache" amounted to 11% of database
               time.
         SYMPTOM: Wait class "Concurrency" was consuming significant database
                  time. (13% impact [39 seconds])
FINDING 4: 32% impact (97 seconds)
----------------------------------
Hard parsing of SQL statements was consuming significant database time.
   NO RECOMMENDATIONS AVAILABLE
   ADDITIONAL INFORMATION:
      Hard parses due to cursor environment mismatch were not consuming
      significant database time.
      Hard parsing SQL statements that encountered parse errors was not
      consuming significant database time.
      Hard parses due to literal usage and cursor invalidation were not
      consuming significant database time.
      The SGA was adequately sized.
   SYMPTOMS THAT LED TO THE FINDING:
      SYMPTOM: Contention for latches related to the shared pool was consuming
               significant database time. (12% impact [36 seconds])
         INFO: Waits for "latch: library cache" amounted to 11% of database
               time.
         SYMPTOM: Wait class "Concurrency" was consuming significant database
                  time. (13% impact [39 seconds])
FINDING 5: 2.6% impact (8 seconds)
----------------------------------
Session connect and disconnect calls were consuming significant database time.
   RECOMMENDATION 1: Application Analysis, 2.6% benefit (8 seconds)
      ACTION: Investigate application logic for possible reduction of connect
         and disconnect calls. For example, you might use a connection pool
         scheme in the middle tier.
FINDING 6: 2.2% impact (7 seconds)
----------------------------------
PL/SQL execution consumed significant database time.
   RECOMMENDATION 1: SQL Tuning, 2.2% benefit (7 seconds)
      ACTION: Tune the PL/SQL block with SQL_ID "0d4kcvj32z62p". Refer to the
         "Tuning PL/SQL Applications" chapter of Oracle's "PL/SQL User's Guide
         and Reference"
         RELEVANT OBJECT: SQL statement with SQL_ID 0d4kcvj32z62p
         begin
         for i in 1..1000000 loop
         execute immediate 'insert into scott.t1 values ('||i||')';
         end loop;
         end;
FINDING 7: 1.8% impact (5 seconds)
----------------------------------
Buffer cache writes due to small log files were consuming significant database
time.
   RECOMMENDATION 1: DB Configuration, 1.8% benefit (5 seconds)
      ACTION: Increase the size of the log files to 188 M to hold at least 20
         minutes of redo information.
   SYMPTOMS THAT LED TO THE FINDING:
      SYMPTOM: The throughput of the I/O subsystem was significantly lower
               than expected. (1% impact [3 seconds])
         SYMPTOM: Wait class "User I/O" was consuming significant database
                  time. (2.1% impact [6 seconds])
FINDING 8: 1.2% impact (4 seconds)
----------------------------------
Undo I/O was a significant portion (59%) of the total database I/O.
   NO RECOMMENDATIONS AVAILABLE
   SYMPTOMS THAT LED TO THE FINDING:
      SYMPTOM: The throughput of the I/O subsystem was significantly lower
               than expected. (1% impact [3 seconds])
         SYMPTOM: Wait class "User I/O" was consuming significant database
                  time. (2.1% impact [6 seconds])
FINDING 9: 1% impact (3 seconds)
--------------------------------
The throughput of the I/O subsystem was significantly lower than expected.
   RECOMMENDATION 1: Host Configuration, 1% benefit (3 seconds)
      ACTION: Consider increasing the throughput of the I/O subsystem.
         Oracle's recommended solution is to stripe all data file using the
         SAME methodology. You might also need to increase the number of disks
         for better performance. Alternatively, consider using Oracle's
         Automatic Storage Management solution.
      RATIONALE: During the analysis period, the average data files' I/O
         throughput was 18 K per second for reads and 74 K per second for
         writes. The average response time for single block reads was 19
         milliseconds.
   RECOMMENDATION 2: Host Configuration, 1% benefit (3 seconds)
      ACTION: The performance of file
         /u01/app/oracle/oradata/prod/system01.dbf was significantly worse
         than other files. If striping all files using the SAME methodology is
         not possible, consider striping this file over multiple disks.
         RELEVANT OBJECT: database file
         "/u01/app/oracle/oradata/prod/system01.dbf"
      RATIONALE: The average response time for single block reads for this
         file was 20 milliseconds.
   SYMPTOMS THAT LED TO THE FINDING:
      SYMPTOM: Wait class "User I/O" was consuming significant database time.
               (2.1% impact [6 seconds])
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          ADDITIONAL INFORMATION
          ----------------------
Wait class "Application" was not consuming significant database time.
Wait class "Commit" was not consuming significant database time.
Wait class "Configuration" was not consuming significant database time.
Wait class "Network" was not consuming significant database time.
The analysis of I/O performance is based on the default assumption that the
average read time for one database block is 10000 micro-seconds.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          TERMINOLOGY
          -----------
DATABASE TIME: This is the ADDM's measurement of throughput. From the user's
   point of view: this is the total amount of time spent by users waiting for
   a response from the database after issuing a call (not including
   networking). From the database instance point of view: this is the total
   time spent by forground processes waiting for a database resource (e.g.,
   read I/O), running on the CPU and waiting for a free CPU (run-queue). The
   target of ADDM analysis is to reduce this metric as much as possible,
   thereby reducing the instance's response time.
AVERAGE DATABASE LOAD: At any given time we can count how many users (also
   called 'Active Sessions') are waiting for an answer from the instance. This
   is the ADDM's measurement for instance load. The 'Average Database Load' is
   the average of the the load measurement taken over the entire analysis
   period. We get this number by dividing the 'Database Time' by the analysis
   period. For example, if the analysis period is 30 minutes and the 'Database
   Time' is 90 minutes, we have an average of 3 users waiting for a response.
IMPACT: Each finding has an 'Impact' associated with it. The impact is the
   portion of the 'Database Time' the finding deals with. If we assume that
   the problem described by the finding is completely solved, then the
   'Database Time' will be reduced by the amount of the 'Impact'.
BENEFIT: Each recommendation has a 'benefit' associated with it. The ADDM
   analysis estimates that the 'Database Time' can be reduced by the 'benefit'
   amount if all the actions of the recommendation are performed.
Elapsed: 00:00:00.51

7、诊断分析结果

   我们从上面的建议结果看到了,ADDM Report的结果与Statspack Report的结果大不相同。Statspack Report的结果给出的都是统计数据、各种事件,然后由DBA根据这些数据给出优化建议,而ADDM Report的结果包含就已经是给出的优化建议了

第一部分:

 Analysis Period: 15-AUG-2014 from 15:40:18 to 15:42:39
         Database ID/Instance: 199802235/1
      Database/Instance Names: PROD/prod
                    Host Name: rh55
             Database Version: 10.2.0.1.0
               Snapshot Range: from 192 to 193
                Database Time: 305 seconds
        Average Database Load: 2.2 active sessions

这一部分包括一些基础信息,分析时间段、DBinstance ID&名字、主机名字、Oracle版本、快照范围、数据库消耗时间、多少个活动会话。


第二部分:
    下面就是ADDM发现的问题,并给出的相应建议。在我们这个例子中总共发现9个问题,下面一一解释一下。

 第一个问题:

FINDING 1: 100% impact (305 seconds)
------------------------------------
Host CPU was a bottleneck and the instance was consuming 88% of the host CPU.
All wait times will be inflated by wait for CPU.
   RECOMMENDATION 1: Host Configuration, 100% benefit (305 seconds)
      ACTION: Consider adding more CPUs to the host or adding instances
         serving the database on other hosts.
      ACTION: Also consider using Oracle Database Resource Manager to
         prioritize the workload from various consumer groups.
         
   RECOMMENDATION 2: Application Analysis, 33% benefit (101 seconds)
      ACTION: Parsing SQL statements were consuming significant CPU. Please
         refer to other findings in this task about parsing for further
         details.
   ADDITIONAL INFORMATION:
      Host CPU consumption was 100%.  CPU runqueue statistics are not
      available from the host's OS. This disables ADDM's ability to estimate
      the impact of this finding.  The instance spent significant time on CPU.
      However, there were no predominant SQL statements responsible for the
      CPU load.
这个问题的描述是,实例消耗的CPU事件占据了大量的数据库运行时间。ADDM给了两个建议
建议一:由于占用了大量的CPU资源,Oracle建议添加更多的CPU,或者使用Oracle Resource Manager进行资源的优化
建议二:Parse占用了大量的CPU时间,建议对sql语句进行优化,减少parse占用的cpu时间
      
第二个问题:
FINDING 2: 96% impact (294 seconds)
-----------------------------------
SQL statements consuming significant database time were found.
   RECOMMENDATION 1: SQL Tuning, 92% benefit (280 seconds)
      ACTION: Tune the PL/SQL block with SQL_ID "0d4kcvj32z62p". Refer to the
         "Tuning PL/SQL Applications" chapter of Oracle's "PL/SQL User's Guide
         and Reference"
         RELEVANT OBJECT: SQL statement with SQL_ID 0d4kcvj32z62p
         begin
         for i in 1..1000000 loop
         execute immediate 'insert into scott.t1 values ('||i||')';
         end loop;
         end;
 Oracle建议对“  execute immediate 'insert into scott.t1 values ('||i||')'; ”语句进行优化,可以将性能提高92%,这个sql也是影响我们性能的最主要的语句。     
 
第三个问题:         
         
FINDING 3: 49% impact (149 seconds)
-----------------------------------
Soft parsing of SQL statements was consuming significant database time.
   RECOMMENDATION 1: Application Analysis, 49% benefit (149 seconds)
      ACTION: Investigate application logic to keep open the frequently used
         cursors. Note that cursors are closed by both cursor close calls and
         session disconnects.
         
   RECOMMENDATION 2: DB Configuration, 49% benefit (149 seconds)
      ACTION: Consider increasing the maximum number of open cursors a session
         can have by increasing the value of parameter "open_cursors".
      ACTION: Consider increasing the session cursor cache size by increasing
         the value of parameter "session_cached_cursors".
      RATIONALE: The value of parameter "open_cursors" was "300" during the
         analysis period.
      RATIONALE: The value of parameter "session_cached_cursors" was "20"
         during the analysis period.
   SYMPTOMS THAT LED TO THE FINDING:
      SYMPTOM: Contention for latches related to the shared pool was consuming
               significant database time. (12% impact [36 seconds])
         INFO: Waits for "latch: library cache" amounted to 11% of database
               time.
         SYMPTOM: Wait class "Concurrency" was consuming significant database
                  time. (13% impact [39 seconds])
                  
  问题三,Oracle建议减少软解析的次数,对经常调用的cursor进行cache;可以调整“ session_cached_cursors", "open_cursors"等参数。 
     
第四个问题:
                 
FINDING 4: 32% impact (97 seconds)
----------------------------------
Hard parsing of SQL statements was consuming significant database time.
   NO RECOMMENDATIONS AVAILABLE
   ADDITIONAL INFORMATION:
      Hard parses due to cursor environment mismatch were not consuming
      significant database time.
      Hard parsing SQL statements that encountered parse errors was not
      consuming significant database time.
      Hard parses due to literal usage and cursor invalidation were not
      consuming significant database time.
      The SGA was adequately sized.
   SYMPTOMS THAT LED TO THE FINDING:
      SYMPTOM: Contention for latches related to the shared pool was consuming
               significant database time. (12% impact [36 seconds])
         INFO: Waits for "latch: library cache" amounted to 11% of database
               time.
         SYMPTOM: Wait class "Concurrency" was consuming significant database
                  time. (13% impact [39 seconds])
                  
 减少硬解析次数,使用绑定变量或者调整library cache的size
 
 
第五个问题:
                 
FINDING 5: 2.6% impact (8 seconds)
----------------------------------
Session connect and disconnect calls were consuming significant database time.
   RECOMMENDATION 1: Application Analysis, 2.6% benefit (8 seconds)
      ACTION: Investigate application logic for possible reduction of connect
         and disconnect calls. For example, you might use a connection pool
         scheme in the middle tier.
         
Oracle建议通过中间件建立connection pool减少会话连接的资源消耗

第六个问题:
         
FINDING 6: 2.2% impact (7 seconds)
----------------------------------
PL/SQL execution consumed significant database time.
   RECOMMENDATION 1: SQL Tuning, 2.2% benefit (7 seconds)
      ACTION: Tune the PL/SQL block with SQL_ID "0d4kcvj32z62p". Refer to the
         "Tuning PL/SQL Applications" chapter of Oracle's "PL/SQL User's Guide
         and Reference"
         RELEVANT OBJECT: SQL statement with SQL_ID 0d4kcvj32z62p
         begin
         for i in 1..1000000 loop
         execute immediate 'insert into scott.t1 values ('||i||')';
         end loop;
         end;
Oracle建议对“  execute immediate 'insert into scott.t1 values ('||i||')'; ”语句进行优化  

第七个问题:       
         
FINDING 7: 1.8% impact (5 seconds)
----------------------------------
Buffer cache writes due to small log files were consuming significant database
time.
   RECOMMENDATION 1: DB Configuration, 1.8% benefit (5 seconds)
      ACTION: Increase the size of the log files to 188 M to hold at least 20
         minutes of redo information.
   SYMPTOMS THAT LED TO THE FINDING:
      SYMPTOM: The throughput of the I/O subsystem was significantly lower
               than expected. (1% impact [3 seconds])
         SYMPTOM: Wait class "User I/O" was consuming significant database
                  time. (2.1% impact [6 seconds])
由于日志切换比较频繁,Oracle建议调整redo size;建议调整为:Increase the size of the log files to 188 M to hold at least 20 minutes of redo information.                  
第八个问题:
                 
FINDING 8: 1.2% impact (4 seconds)
----------------------------------
Undo I/O was a significant portion (59%) of the total database I/O.
   NO RECOMMENDATIONS AVAILABLE
   SYMPTOMS THAT LED TO THE FINDING:
      SYMPTOM: The throughput of the I/O subsystem was significantly lower
               than expected. (1% impact [3 seconds])
         SYMPTOM: Wait class "User I/O" was consuming significant database
                  time. (2.1% impact [6 seconds])
                  
Oracle建议调整undo datafile的I/O

第九个问题:
                  
FINDING 9: 1% impact (3 seconds)
--------------------------------
The throughput of the I/O subsystem was significantly lower than expected.
   RECOMMENDATION 1: Host Configuration, 1% benefit (3 seconds)
      ACTION: Consider increasing the throughput of the I/O subsystem.
         Oracle's recommended solution is to stripe all data file using the
         SAME methodology. You might also need to increase the number of disks
         for better performance. Alternatively, consider using Oracle's
         Automatic Storage Management solution.
      RATIONALE: During the analysis period, the average data files' I/O
         throughput was 18 K per second for reads and 74 K per second for
         writes. The average response time for single block reads was 19
         milliseconds.
         
   RECOMMENDATION 2: Host Configuration, 1% benefit (3 seconds)
      ACTION: The performance of file
         /u01/app/oracle/oradata/prod/system01.dbf was significantly worse
         than other files. If striping all files using the SAME methodology is
         not possible, consider striping this file over multiple disks.
         RELEVANT OBJECT: database file
         "/u01/app/oracle/oradata/prod/system01.dbf"
      RATIONALE: The average response time for single block reads for this
         file was 20 milliseconds.
   SYMPTOMS THAT LED TO THE FINDING:
      SYMPTOM: Wait class "User I/O" was consuming significant database time.
               (2.1% impact [6 seconds])

调整磁盘的I/O,可以通过strip,来对磁盘I/O进行优化;建议对system表空间进行I/O优化,可以通过条带化将数据存储到多个磁盘上。

8、使用STA来优化语句
        ADDM得出了诊

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
MySQL索引基數如何影響查詢性能?MySQL索引基數如何影響查詢性能?Apr 14, 2025 am 12:18 AM

MySQL索引基数对查询性能有显著影响:1.高基数索引能更有效地缩小数据范围,提高查询效率;2.低基数索引可能导致全表扫描,降低查询性能;3.在联合索引中,应将高基数列放在前面以优化查询。

MySQL:新用戶的資源和教程MySQL:新用戶的資源和教程Apr 14, 2025 am 12:16 AM

MySQL學習路徑包括基礎知識、核心概念、使用示例和優化技巧。 1)了解表、行、列、SQL查詢等基礎概念。 2)學習MySQL的定義、工作原理和優勢。 3)掌握基本CRUD操作和高級用法,如索引和存儲過程。 4)熟悉常見錯誤調試和性能優化建議,如合理使用索引和優化查詢。通過這些步驟,你將全面掌握MySQL的使用和優化。

現實世界Mysql:示例和用例現實世界Mysql:示例和用例Apr 14, 2025 am 12:15 AM

MySQL在現實世界的應用包括基礎數據庫設計和復雜查詢優化。 1)基本用法:用於存儲和管理用戶數據,如插入、查詢、更新和刪除用戶信息。 2)高級用法:處理複雜業務邏輯,如電子商務平台的訂單和庫存管理。 3)性能優化:通過合理使用索引、分區表和查詢緩存來提升性能。

MySQL中的SQL命令:實踐示例MySQL中的SQL命令:實踐示例Apr 14, 2025 am 12:09 AM

MySQL中的SQL命令可以分為DDL、DML、DQL、DCL等類別,用於創建、修改、刪除數據庫和表,插入、更新、刪除數據,以及執行複雜的查詢操作。 1.基本用法包括CREATETABLE創建表、INSERTINTO插入數據和SELECT查詢數據。 2.高級用法涉及JOIN進行表聯接、子查詢和GROUPBY進行數據聚合。 3.常見錯誤如語法錯誤、數據類型不匹配和權限問題可以通過語法檢查、數據類型轉換和權限管理來調試。 4.性能優化建議包括使用索引、避免全表掃描、優化JOIN操作和使用事務來保證數據一致性

InnoDB如何處理酸合規性?InnoDB如何處理酸合規性?Apr 14, 2025 am 12:03 AM

InnoDB通過undolog實現原子性,通過鎖機制和MVCC實現一致性和隔離性,通過redolog實現持久性。 1)原子性:使用undolog記錄原始數據,確保事務可回滾。 2)一致性:通過行級鎖和MVCC確保數據一致。 3)隔離性:支持多種隔離級別,默認使用REPEATABLEREAD。 4)持久性:使用redolog記錄修改,確保數據持久保存。

MySQL的位置:數據庫和編程MySQL的位置:數據庫和編程Apr 13, 2025 am 12:18 AM

MySQL在數據庫和編程中的地位非常重要,它是一個開源的關係型數據庫管理系統,廣泛應用於各種應用場景。 1)MySQL提供高效的數據存儲、組織和檢索功能,支持Web、移動和企業級系統。 2)它使用客戶端-服務器架構,支持多種存儲引擎和索引優化。 3)基本用法包括創建表和插入數據,高級用法涉及多表JOIN和復雜查詢。 4)常見問題如SQL語法錯誤和性能問題可以通過EXPLAIN命令和慢查詢日誌調試。 5)性能優化方法包括合理使用索引、優化查詢和使用緩存,最佳實踐包括使用事務和PreparedStatemen

MySQL:從小型企業到大型企業MySQL:從小型企業到大型企業Apr 13, 2025 am 12:17 AM

MySQL適合小型和大型企業。 1)小型企業可使用MySQL進行基本數據管理,如存儲客戶信息。 2)大型企業可利用MySQL處理海量數據和復雜業務邏輯,優化查詢性能和事務處理。

幻影是什麼讀取的,InnoDB如何阻止它們(下一個鍵鎖定)?幻影是什麼讀取的,InnoDB如何阻止它們(下一個鍵鎖定)?Apr 13, 2025 am 12:16 AM

InnoDB通過Next-KeyLocking機制有效防止幻讀。 1)Next-KeyLocking結合行鎖和間隙鎖,鎖定記錄及其間隙,防止新記錄插入。 2)在實際應用中,通過優化查詢和調整隔離級別,可以減少鎖競爭,提高並發性能。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
3 週前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解鎖Myrise中的所有內容
4 週前By尊渡假赌尊渡假赌尊渡假赌

熱工具

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

WebStorm Mac版

WebStorm Mac版

好用的JavaScript開發工具

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境