Äú¿ÉÒÔ¾èÖú£¬Ö§³ÖÎÒÃǵĹ«ÒæÊÂÒµ¡£

1Ôª 10Ôª 50Ôª





ÈÏÖ¤Â룺  ÑéÖ¤Âë,¿´²»Çå³þ?Çëµã»÷Ë¢ÐÂÑéÖ¤Âë ±ØÌî



  ÇóÖª ÎÄÕ ÎÄ¿â Lib ÊÓÆµ iPerson ¿Î³Ì ÈÏÖ¤ ×Éѯ ¹¤¾ß ½²×ù Modeler   Code  
»áÔ±   
 
   
 
 
     
   
 ¶©ÔÄ
  ¾èÖú
OracleÐÔÄÜÓÅ»¯¸ÅÊö
 
×÷Õß bobird £¬»ðÁú¹ûÈí¼þ    ·¢²¼ÓÚ 2014-08-08
  2755  次浏览      27
 

1 ÐÔÄÜÓÅ»¯¸ÅÊö

This chapter provides an introduction toperformance tuning and contains the following sections:

±¾Õ½ڸø³öÁËÐÔÄÜÓÅ»¯µÄ¼ò½é£¬Ëü°üº¬ÁËһϼ¸¸ö²¿·Ö¡£

1.Introduction to Performance Tuning

ÐÔÄÜÓÅ»¯µÄ½éÉÜ

2.Introduction to Performance Tuning Features and Tools

ÐÔÄÜÓÅ»¯¹¤¾ßºÍÌØµãµÄ½éÉÜ

1.1 ÐÔÄÜÓÅ»¯¼ò½é

This guide provides information on tuning anOracle Database system for performance. Topics discussed in this guide include:

Õâ¸öС½ÚÌṩÁ˶ÔÒ»¸öoracleÊý¾Ý¿âϵͳ½øÐÐÐÔÄÜÓÅ»¯µÄ֪ʶ¡£°üÀ¨Ò»Ï¼¸¸öÖ÷Ìâ

1.Performance Planning

ÐÔÄܹ滮

2.Instance Tuning

ʵÀýÓÅ»¯

3.SQL Tuning

SqlÓÅ»¯

1.1.1ÐÔÄܹ滮

Before starting on the instance or SQL tuningsections of this guide, make sure you have read Part II, "Performance Planning".

ÔÚѧϰ±¾Ð¡½ÚµÄʵÀýºÍsqlÓÅ»¯²¿·Ö֮ǰ£¬ÇëÏÈÔĶÁII²¿·Ö£ºÐÔÄܹ滮

Based on years of designing and performanceexperience, Oracle has designed a performance methodology. This brief sectionexplains clear and simple activities that can dramatically improve systemperformance. It discusses the following topics:

»ùÓÚ¶àÄêµÄÉè¼ÆºÍÐÔÄÜ·½ÃæµÄ¾­Ñ飬oracleÒѾ­Éè¼ÆÁËÒ»Ì×¹ØÓÚÐÔÄÜ·½ÃæµÄ·½·¨Ìåϵ¡£±¾½ÚÃèÊöÁËÄܹ»ÏÔÖøÌá¸ßϵͳÐÔÄܵÄÇåÎúºÍ¼òµ¥µÄ·½°¸¡£¸Ã·½°¸Éæ¼°µ½Ò»ÏÂÖ÷Ìâ:

1.Understanding Investment Options

Àí½âÄܹ»ÔÚµ÷ÓÅ·½ÃæÆð×÷ÓõÄËùÓÐÒòËØ

2.Understanding Scalability

Àí½â¿ÉÀ©Õ¹ÐÔ

3.System Architecture

ϵͳ¼Ü¹¹

4.Application Design Principles

Ó¦ÓÃÉè¼Æ×¼Ôò

5.Workload Testing, Modeling, and Implementation

¸ºÔزâÊÔ ½¨Á¢Ä£ÐÍ£¬ÊµÏÖ

6.Deploying New Applications

²¿ÊðеÄÓ¦ÓÃ

1.1.2ʵÀýÓÅ»¯

Part III, "Optimizing Instance Performance" ofthis guide discusses the factors involved in the tuning and optimizing of anOracle database instance.

±¾½ÚµÄIII²¿·Ö£¬¡°ÓÅ»¯ÊµÀýÐÔÄÜ¡±ÌÖÂÛÉæ¼°µ½oracleÊý¾Ý¿âʵÀýµ÷ÓźÍÓÅ»¯µÄ¸÷ÖÖÒòËØ¡£

When considering instance tuning, care mustbe taken in the initial design of the database system to avoid bottlenecks thatcould lead to performance problems. In addition, you need to consider:

µ±¿¼ÂÇʵÀýÓÅ»¯µÄʱºò£¬Êý¾Ý¿âϵͳ³õʼ»¯Éè¼Æ±ØÐëҪעÒâ·ÀֹһЩƿ¾±£¬ÕâЩƿ¾±¿ÉÄÜ»á´øÀ´ÐÔÄÜ·½ÃæµÄÎÊÌâ¡£´ËÍâÄãÐèÒª¿¼ÂÇһϼ¸µã£º

1.Allocating memory to database structures

¸øÊý¾Ý¿â·ÖÅäÄÚ´æ

2.Determining I/O requirements of different parts of the database

È·¶¨Êý¾Ý¿âµÄ²»Í¬²¿·ÖµÄI/OÐèÇó

3.Tuning the operating system for optimal performance of the database

µ÷ÓŲÙ×÷ϵͳʹÊý¾Ý¿âϵÄÜ´ïµ½×î¼Ñ

After the database instance has beeninstalled and configured, you need to monitor the database as it is running tocheck for performance-related problems.

ÔÚ°²×°ºÍÅäÖÃÊý¾Ý¿âʵÀýÖ®ºó£¬ÄãÐèÒª¼à¿ØÊý¾Ý¿â£¬ÒòΪËüʱ¿ÌÔËÐÐ×ÅÀ´¼ì²é¸úÐÔÄÜÏà¹ØµÄһЩÎÊÌâ¡£

1.1.2.1ÐÔÄÜ×¼Ôò

Performance tuning requires a different,although related, method to the initial configuration of a system. Configuringa system involves allocating resources in an ordered manner so that the initialsystem configuration is functional.

¶ÔÓÚϵͳµÄ³õʼ»¯ÅäÖÃÀ´Ëµ ÐÔÄܵ÷ÓÅÐèÒªÒ»ÖÖÓëÖ®²»Í¬µÄ¾¡¹ÜÏà¹ØµÄ·½·¨¡£ÒªÒÔÓÐÐòµÄ·½Ê½·ÖÅä×ÊÔ´À´ÅäÖÃÒ»¸öϵͳ£¬ÕâÑùϵͳµÄ³õʼ»¯ÅäÖòÅÄÜÆð×÷Óá£

Tuning is driven by identifying the mostsignificant bottleneck and making the appropriate changes to reduce oreliminate the effect of that bottleneck. Usually, tuning is performedreactively, either while the system is preproduction or after it is live.

ͨ¹ýÕÒµ½×îÖØÒªµÄÆ¿¾±ÇÒ×öһЩºÏÊʵıä¸üÀ´¼õÉÙ»òÏû³ýÆ¿¾±µÄÓ°ÏìÀ´Çý¶¯µ÷ÓŵĽøÐС£Í¨³£À´Ëµ£¬µ÷ÓÅÊÇÐèÒªÓз´Ó¦À´ÑéÖ¤µÄ£¬Õâ¸öϵͳҪôÊÇÔÚÊÔÔËÐÐÖУ¬ÒªÃ´ÊÇÒѾ­ÔÚÉú²úÔËÐÐÁË¡£

1.1.2.2»ùÏß

The most effective way to tune is to have anestablished performance baseline that can be used for comparison if aperformance issue arises. Most database administrators (DBAs) know their systemwell and can easily identify peak usage periods. For example, the peak periodscould be between 10.00am and 12.00pm and also between 1.30pm and 3.00pm. Thiscould include a batch window of 12.00am midnight to 6am.

×îÓÐЧµÄµ÷ÓÅ·½Ê½Êǽ¨Á¢Ò»¸öÐÔÄܵĻù×¼Ïߣ¬ËüÄܹ»±»ÓÃÀ´ÔÚÐÔÄÜÎÊÌâ³öÏÖµÄʱºò×ö±È½Ï¡£´ó²¿·ÖµÄÊý¾Ý¿â¹ÜÀíÔ±¶ÔËûÃǵÄϵͳÊìÖª¶øÇÒÄÜÇáÒ×µÄÅжϳöϵͳʹÓõĸ߷åʱ¶Î¡£ÀýÈ磺¸ß·åʱ¶Î¿ÉÄÜÊÇÉÏÎç10£º00µ½ÏÂÎç12:00£¬Ò²¿ÉÄÜÊÇ

ÏÂÎç1.30µ½3.00.Õâ¿ÉÄܰüÀ¨Á賿12:00µ½6:00µÄÅú´¦Àí´°¿Ú¡£

It is important to identify these peakperiods at the site and install a monitoring tool that gathers performance datafor those high-load times. Optimally, data gathering should be configured fromwhen the application is in its initial trial phase during the QA cycle.Otherwise, this should be configured when the system is first in production.

ÕÒµ½ÕâЩÕâЩ¸ß·åʱ¶ÎºÍ°²×°Ò»¸öÄܹ»ÊÕ¼¯¸ß¸ºÔØÊ±¶ÎÐÔÄÜÊý¾ÝµÄ¼à¿Ø¹¤¾ß¶¼ÊǷdz£ÖØÒªµÄ¡£ÀíÏëÇé¿öÏ£¬Êý¾Ý²É¼¯Ó¦¸ÃÊÇ´ÓÓ¦ÓõÄÖÊÁ¿±£Ö¤ÉúÃüÖÜÆÚÖеijõʼ»¯ÊÔÑé½×¶Î¿ªÊ¼ÅäÖ᣷ñÔò£¬Ó¦¸ÃÔÚϵͳÊ×´ÎÓ¦ÓÃÓÚÉú²úʱÅäÖá£

Ideally, baseline data gathered shouldinclude the following:

ÀíÏëÇé¿öÏ£¬»ù×¼ÏßÊý¾ÝÓ¦¸Ã°üÀ¨ÒÔÏÂÄÚÈÝ£º

1.Application statistics (transaction volumes, response time)

Ó¦ÓóÌÐòͳ¼ÆÐÅÏ¢£¨½»Ò×Á¿£¬ÏìӦʱ¼ä£©

2.Database statistics

Êý¾Ý¿âͳ¼ÆÐÅÏ¢

3.Operating system statistics

²Ù×÷ϵͳͳ¼ÆÐÅÏ¢

4.Disk I/O statistics

´ÅÅÌ ÊäÈëÊä³ö ͳ¼ÆÐÅÏ¢

5.Network statistics

ÍøÂçͳ¼ÆÐÅÏ¢

In the Automatic Workload Repository,baselines are identified by a range of snapshots that are preserved for futurecomparisons. See "Overview of the Automatic Workload Repository".

ÔÚ×Ô¶¯¹¤×÷Á¿ÖªÊ¶¿âÀïÃæ£¬»ùÏßÓÉһϵÁеĿìÕÕÐγɣ¬ÕâЩ¿ìÕջᱻ±£´æÒÔ±ãÈÕºó±È½Ï¡£Ïé¼û¡°×Ô¶¯¹¤×÷¸ºÔØ¿â¸ÅÊö¡±¡£

1.1.2.3Ö¢×´ºÍÎÊÌâ

A common pitfall in performance tuning is tomistake the symptoms of a problem for the actual problem itself. It isimportant to recognize that many performance statistics indicate the symptoms,and that identifying the symptom is not sufficient data to implement a remedy.For example:

ÐÔÄܵ÷ÓŵÄÒ»¸ö³£¼ûÏÝÚåÊÇ´íÎóµÄ°ÑÎÊÌâµÄÖ¢×´£¨±íÏÖ£©µ±³ÉÊÇÎÊÌâµÄʵÖÊÁË¡£ÈÏʶµ½´óÁ¿ÐÔÄÜͳ¼ÆÐÅϢԤʾ×ÅÎÊÌâµÄÖ¢×´ÊǺÜÖØÒªµÄ¡£µ±È»£¬Í¬Ê±ÈÏʶµ½Ö¢×´²¢²»ÄܸøÎÊÌâ²¹¾ÈÌṩ³ä·ÖµÄÊý¾ÝÒ²·Ç³£ÖØÒª¡£

Slow physical I/O

»ºÂýµÄÎïÀíÊäÈëÊä³ö

Generally, this is caused bypoorly-configured disks. However, it could also be caused by a significantamount of unnecessary physical I/O on those disks issued by poorly-tuned SQL.

ͨ³£Çé¿öÏ£¬ÕâÊÇÓɽϴÎÅäÖõĴÅÅÌÒýÆðµÄ¡£È»¶øËûÒ²¿ÉÄÜÓÉ´óÁ¿µÄ²»±ØÒªµÄ´ÅÅÌÎïÀíÊäÈëÊä³öÒýÆð£¬¶øÕâЩÊäÈëÊä³öÊÇÓÉÀ¬»øsqlµ¼Ö¡£

Latch contention

ãÅËøÕùÓÃ

Rarely is latch contention tunable byreconfiguring the instance. Rather, latch contention usually is resolvedthrough application changes.

ͨ¹ýÖØÐÂÅäÖÃʵÀýÀ´ÊµÏÖãÅËøÕùÓÃÎÊÌâ¿Éµ÷ÊǺÜÉٵģ¬Ïà·´ãÅËøÕùÓÃͨ³£Í¨¹ý¸Ä±äÓ¦ÓóÌÐòÀ´½â¾ö¡£

Excessive CPU usage

CPUʹÓÃÂʹý¸ß

Excessive CPU usage usually means that thereis little idle CPU on the system. This could be caused by an inadequately-sizedsystem, by untuned SQL statements, or by inefficient application programs.

¹ý¸ßµÄcpuʹÓÃÂÊͨ³£Òâζ×Åϵͳ»áÓкÜÉÙ¿ÕÏеÄcpu¡£Õâ¿ÉÄÜÓÉϵͳ¹æÄ£²»Êʵ± »òδ¾­ÓÅ»¯µÄsql »òÕß µÍЧÂʵÄÓ¦ÓóÌÐòµ¼Ö¡£

1.1.2.4ºÎʱµ÷ÓÅ

There are two distinct types of tuning:

Á½ÖÖ²»Í¬·½Ê½µÄµ÷ÓÅ

1.Proactive Monitoring

Ö÷¶¯¼à²â

2.Bottleneck Elimination

Ïû³ýÆ¿¾±

1.1.2.4.1Ö÷¶¯¼à²â

Proactive monitoring usually occurs on aregularly scheduled interval, where a number of performance statistics areexamined to identify whether the system behavior and resource usage haschanged. Proactive monitoring can also be considered as proactive tuning.

Ö÷¶¯¼à²âͨ³£·¢ÉúÔÚÒ»¸ö¶¨ÆÚµÄ¼Æ»®¼ä¸ô£¬ÄÇÀһ¶¨ÊýÁ¿µÄÐÔÄÜͳ¼ÆÊý¾Ý»á±»¼ì²âÀ´È·¶¨ÏµÍ³µÄÔËÐкÍ×ÊÔ´ÀûÓÃÂÊÊÇ·ñÒѾ­±»¸Ä±ä¡£Ö÷¶¯¼à²âÒ²¿ÉÒÔ±»¿´×÷ÊÇÖ÷¶¯µ÷ÓÅ¡£

Usually, monitoring does not result inconfiguration changes to the system, unless the monitoring exposes a seriousproblem that is developing. In some situations, experienced performanceengineers can identify potential problems through statistics alone, althoughaccompanying performance degradation is usual.

Experimenting with or tweaking a system whenthere is no apparent performance degradation as a proactive action can be adangerous activity, resulting in unnecessary performance drops. Tweaking asystem should be considered reactive tuning, and the steps for reactive tuningshould be followed.

Monitoring is usually part of a largercapacity planning exercise, where resource consumption is examined to seechanges in the way the application is being used, and the way the applicationis using the database and host resources.

ͨ³££¬¼à¿Ø²¢²»¸Ä±äϵͳµÄÅäÖ㬳ý·ÇËû±©Â¶³öÁËÕýÔÚ·¢ÉúµÄһЩÑÏÖØµÄÎÊÌâ¡£ÔÚһЩÇé¿öÏ£¬Óо­ÑéµÄÐÔÄܹ¤³ÌʦÄܹ»Ö»Í¨¹ýͳ¼ÆÐÅÏ¢½â¾öDZÔÚµÄÎÊÌ⣬¾¡¹Ü°éËæ×ÅÐÔÄܵÄϽµ¡£µ±Ã»ÓÐÏÔÖøµÄÐÔÄÜϽµÊ±£¬Ö÷¶¯µ÷ÕûºÍÊÔÑéϵͳÊÇΣÏյ쬻áÔì³Éϵͳ²»±ØÒªµÄÐÔÄÜϽµ¡£µ÷ÕûϵͳÐèÒª¿¼ÂÇ·´Ó¦µ÷г£¬¶øÇÒ·´Ó¦µ÷ÓŵIJ½ÖèÒª±»¸ú×Ù¡£

¼à²âͨ³£ÊǸü´ó¹æÄ£µÄ¹æ»®¹¤×÷ÖеÄÒ»²¿·Ö,ÄDz¿·ÖÀïÃæ£¬×ÊÔ´ÏûºÄ±»¼ì²âÀ´¹Û²âÓ¦Óñ»Ê¹Óõķ½Ê½ºÍ Êý¾Ý¿â¼° Ö÷»ú×ÊÔ´µÄ¸Ä±ä¡£

1.1.2.4.2Æ¿¾±Ïû³ý

Tuning usually implies fixing a performanceproblem. However, tuning should be part of the life cycle of an application¡ªthrough the analysis, design, coding,production, and maintenance stages. Oftentimes, the tuning phase is left untilthe system is in production. At this time, tuning becomes a reactivefire-fighting exercise, where the most important bottleneck is identified andfixed.

Usually, the purpose for tuning is to reduceresource consumption or to reduce the elapsed time for an operation tocomplete. Either way, the goal is to improve the effective use of a particularresource. In general, performance problems are caused by the over-use of aparticular resource. That resource is the bottleneck in the system. There are anumber of distinct phases in identifying the bottleneck and the potentialfixes. These are discussed in the sections that follow.

µ÷ÓÅͨ³£Òâζ×ÅÐÞ¸´ÐÔÄÜÎÊÌ⡣Ȼ¶øµ÷ÓÅÓ¦¸ÃÊÇÓ¦ÓóÌÐòÕû¸öÉúÃüÖÜÆÚµÄÒ»²¿·Ö£¬°üÀ¨·ÖÎö£¬Éè¼Æ£¬±àÂ룬Éú²ú£¬Î¬»¤½×¶Î¡£¾­³£µÄÇé¿öÊǵ÷ÓŽ׶λáÒ»Ö±±£Áôµ½µ½ÏµÍ³Éú²úÔËÐвÅÀ뿪¡£ÄǸöʱºòµ÷ÓÅÒѾ­±ä³ÉÏìÓ¦µÄ¹¤×÷£¬´ó¶àÊýÖØÒªµÄÆ¿¾±ÒѾ­±»Ê¶±ðºÍÐÞ¸´¡£

ͨ³£Çé¿öÏ£¬µ÷ÓŵÄÄ¿µÄÊÇΪÁ˼õÉÙ×ÊÔ´ÏûºÄ»òÕß¼õÉÙijÏî²Ù×÷Íê³ÉµÄºÄʱ¡£ÎÞÂÛÄÄÖÖ·½Ê½£¬Ä¿µÄ¶¼ÊÇΪÁËÌá¸ßij¸öÌØÊâ×ÊÔ´µÄÓÐЧÀûÓá£Ò»°ãÀ´Ëµ£¬ÐÔÄÜÎÊÌâ¶¼ÊÇÓÉij¸öÌØÊâ×ÊÔ´¹ý¶ÈʹÓÃÔì³ÉµÄ£¬ÄǸö×ÊÔ´ÕýºÃÊÇϵͳµÄÆ¿¾±¡£±æÊ¶³öÆ¿¾±ºÍDZÔÚµÄÎÊÌâÓÐÐí¶à²»Í¬µÄ½×¶Î¡£ÕâЩ¶«Î÷½«ÔÚÒÔϲ¿·Ö±»ÌÖÂÛ£º

Remember that the different forms ofcontention are symptoms that can be fixed by making changes in the followingplaces:

Çë¼Çס¾ºÕùµÄ²»Í¬ÐÎʽÊÇһЩ֢״£¬ÕâЩ֢״Äܹ»±»ÔÚÒÔϵط½×öЩ¸Ä±äÀ´ÐÞ¸´¡¢

1.Changes in the application, or the way the application is used

Ó¦ÓóÌÐòµÄ¸Ä±ä£¬»òÕßÓ¦ÓóÌÐò±»Ê¹Ó÷½Ê½µÄ¸Ä±ä

2.Changes in Oracle

oracleµÄ¸Ä±ä

3.Changes in the host hardware configuration

Ö÷»úÓ²¼þÅäÖõĸı䡣

Often, the most effective way of resolving abottleneck is to change the application.

¾­³£Çé¿öÏ£¬½â¾öÆ¿¾±×îÓÐЧµØ·½Ê½ÊǸıäÒ»¸öÓ¦ÓóÌÐò¡£

1.1.3 SQL ÓÅ»¯

Part IV, "Optimizing SQL Statements" ofthis guide discusses the process of tuning and optimizing SQL statements.

±¾½ÚµÄIV²¿·Ö ÌÖÂÛµ½Á˵÷ÓŵĹý³Ì ºÍsqlµÄÓÅ»¯¡£

Many client/server application programmersconsider SQL a messaging language, because queries are issued and data isreturned. However, client tools often generate inefficient SQL statements.Therefore, a good understanding of the database SQL processing engine isnecessary for writing optimal SQL. This is especially true for high transactionprocessing systems.

Ðí¶à¿Í»§¶ËºÍ·þÎñ¶ËµÄÓ¦ÓóÌÐò¿ª·¢Õß°Ñsqlµ±×öÊÇÒ»ÖÖÏûÏ¢ÓïÑÔ£¬ÒòΪ²éѯ·¢Æðºó¾Í»á·µ»Ø½á¹ûÊý¾Ý¡£È»¶ø¿Í»§¶Ë¹¤¾ß³£³£»á²ú³öһЩµÍЧÂʵÄsql¡£Òò´Ë£¬¶ÔÊý¾Ý¿âsql´¦Àí¹¤×÷»úÖÆÓиöºÜºÃµÄÀí½â¶Ôд³ö×îÓŵÄsqlÊDZØÒªµÄ¡£Õâ¶Ô¸ßÊÂÎï´¦ÀíϵͳÓÈÆä¹ÜÓá£

Typically, SQL statements issued by OLTPapplications operate on relatively few rows at a time. If an index can point tothe exact rows that are required, then Oracle can construct an accurate plan toaccess those rows efficiently through the shortest possible path. In decisionsupport system (DSS) environments, selectivity is less important, because theyoften access most of a table's rows. In such situations, full table scans arecommon, and indexes are not even used. This book is primarily focussed onOLTP-type applications. For detailed information on DSS and mixed environments,see the Oracle Database Data Warehousing Guide.

ͨ³£Çé¿öÏ£¬ÓÉÁª»úÊÂÎñ´¦Àíϵͳ·¢ÆðµÄsqlÓï¾äÔÚͬһʱ¼ä»á²Ù×÷Ïà¶ÔÉÙµÄÐС£Èç¹ûÒ»¸öË÷ÒýÄܹ»¶¨Î»ËüËùÐèÒªµÄ׼ȷÐУ¬ÄÇôoracleÄܹ»Í¨¹ý¿ÉÄܵÄ×î¶ÌµÄ·¾¶À´½¨Á¢Ò»¸ö׼ȷµÄ¼Æ»®À´È¡µ½ÄÇЩÐС£ÔÚ¾ö²ßÖ§³Åϵͳ»·¾³µ±ÖУ¬²éѯÊÇ´ÎÒªµÄ£¬ÒòΪËûÃÇ×ÜÊÇÒª»ñÈ¡±íÖеĴ󲿷ÖÐС£¡£ÔÚÕâ¸öÇé¿öÏÂÈ«±íɨÃèÊÇÆÕ±éµÄ£¬Ë÷ÒýÉõÖÁ¿ÉÄܶ¼Ã»±»Óõ½¡£ÕâÀïÖ÷ÒªµÄ¹Ø×¢µã¶¼ÔÚÁª»úÊÂÎñ´¦Àíϵͳ¡£ÈôÒª»ñµÃ¾ö²ßÖ§³ÅϵͳºÍ»ìºÏ»·¾³¸üÏêϸµÄÐÅÏ¢£¬Çë¿´ oracleÊý¾Ý¿âÊý¾Ý²Ö¿âÖ¸ÄÏ¡£

1.1.3.1²éѯÓÅ»¯Æ÷ºÍÖ´Ðмƻ®

When a SQL statement is executed on an Oracledatabase, the Oracle query optimizer determines the most efficient executionplan after considering many factors related to the objects referenced and theconditions specified in the query. This determination is an important step inthe processing of any SQL statement and can greatly affect execution time.

µ±Ò»¸ösqlÓï¾äÔÚoracleÊý¾Ý¿âÉÏÖ´ÐеÄʱºò£¬ÔÚ¿¼ÂǹýÉæ¼°µ½µÄÈô¸É¶ÔÏóµÄÐí¶àÏà¹ØÒòËØºÍ²éѯʱµÄһЩ¾ßÌåÇé¿öºóoracle²éѯÓÅ»¯Æ÷»á¾ö¶¨ÄĸöÊÇ×î¸ßЧµÄÖ´Ðмƻ®¡£Õâ¸ö¾ö¶¨ÊÇÈκÎsqlÓï¾äÖ´Ðйý³ÌµÄÖØÒªÒ»²½£¬¶øÇÒ¶ÔÖ´ÐÐʱ¼äÓ°ÏìºÜ´ó¡£

During the evaluation process, the queryoptimizer reviews statistics gathered on the system to determine the best dataaccess path and other considerations. You can override the execution plan ofthe query optimizer with hints inserted in SQL statement.

ÔÚÆÀ¹ÀÆÚ¼ä£¬²éѯÓÅ»¯Æ÷»á¼ì²éϵͳÊÕ¼¯µÄͳ¼ÆÐÅÏ¢À´¾ö¶¨×îºÃµÄÈ¡Êý¾Ý;¾¶ºÍÆäËû¿¼ÂÇ¡£Äã¿ÉÒÔÔÚsqlÓï¾äÖвåÈëhintÌáʾÀ´¸²¸Ç²éѯÓÅ»¯Æ÷µÄÖ´Ðмƻ®¡£

1.2ÐÔÄܵ÷ÓÅÌØÐԺ͹¤¾ß

Effective data collection and analysis isessential for identifying and correcting performance problems. Oracle providesa number of tools that allow a performance engineer to gather informationregarding database performance. In addition to gathering data, Oracle providestools to monitor performance, diagnose problems, and tune applications.

ÓÐЧÊý¾ÝµÄÊÕ¼¯·ÖÎö¶ÔÕÒ³ö²¢¸ÄÕýÐÔÄÜÎÊÌâÊǺܱØÒªµÄ¡£¾ÍÊý¾Ý¿âµÄÐÔÄÜ£¬oracleÌṩÁË´óÁ¿µÄ¹¤¾ß£¬ÕâЩ¹¤¾ßÔÊÐíÐÔÄܵ÷ÓŹ¤³ÌʦÊÕ¼¯ÐÅÏ¢.³ýÁËÊÕ¼¯Êý¾Ý£¬oracleÌṩÁËһЩ¹¤¾ßÀ´¼à²âÐÔÄÜ£¬Õï¶ÏÎÊÌâºÍµ÷ÓÅÓ¦ÓóÌÐò¡£

The Oracle gathering and monitoring featuresare mainly automatic, managed by an Oracle background processes. To enableautomatic statistics collection and automatic performance features,the STATISTICS_LEVEL initialization parameter must be setto TYPICAL or ALL. You can administer and display the output ofthe gathering and tuning tools with Oracle Enterprise Manager, or with APIs andviews. For ease of use and to take advantage of its numerous automated monitoringand diagnostic tools, Oracle Enterprise Manager Database Control isrecommended.

oracleÊÕ¼¯ºÍ¼à¿ØÌØÐÔÖ÷Òª¶¼ÊÇ×Ô¶¯µÄ£¬±»oracleºǫ́½ø³Ì¹ÜÀí¡£ÎªÁËʹͳ¼ÆÊÕ¼¯ºÍÐÔÄܹ¦ÄÜ×Ô¶¯»¯£¬Í³¼Æ¼¶±ðÕâ¸ö³õʼ»¯²ÎÊý±ØÐë±»ÉèÖÃΪµäÐÍ»òÍêÈ«¡£Äã¿ÉÒÔÓÃoracleÆóÒµ¹ÜÀíÆ÷»òÕßAPI»òÕßÊÓͼÀ´Õ¹Ê¾ºÍ¹ÜÀíͳ¼ÆÐÅÏ¢ÊÕ¼¯ºÍµ÷ÓŹ¤¾ßµÄÊä³ö½á¹û¡£ÎªÁ˸ü¼Ó·½±ãµÄʹÓúÍÀûÓôóÁ¿µÄ×Ô¶¯¼à²âÕï¶Ï¹¤¾ß£¬ÍƼöʹÓÃoracleÆóÒµ¹ÜÀíÆ÷Êý¾Ý¿â¿ØÖÆ¡£

1.2.1×Ô¶¯ÐÔÄܵ÷ÓÅÌØÐÔ

The Oracle automatic performance tuningfeatures include:

oracle ×Ô¶¯ÐÔÄܵ÷ÓÅÌØÐÔ°üÀ¨ÒÔÏÂ

1.Automatic Workload Repository (AWR) collects, processes, and maintains performance statistics for problem detection and self-tuning purposes. See "Overview of the Automatic Workload Repository".

×Ô¶¯¹¤×÷ÐÅÏ¢¿âÊÕ¼¯£¬¼Ó¹¤ºÍά»¤ÐÔÄÜͳ¼ÆÐÅÏ¢À´¼ì²âÎÊÌâºÍ×ÔÎÒÓÅ»¯¡£Ïê¼û×Ô¶¯¸ºÔØÐÅÏ¢¿â¸ÅÂÛ¡£

2.Automatic Database Diagnostic Monitor (ADDM) analyzes the information collected by the AWR for possible performance problems with the Oracle database. See "Automatic Database Diagnostic Monitor".

×Ô¶¯Êý¾Ý¿âÕï¶ÏºÍ¼à²â¹¤¾ßÕë¶ÔoracleÊý¾Ý¿â¿ÉÄܵÄÐÔÄÜÎÊÌâ·ÖÎöÁËAWRÊÕ¼¯µÄÐÅÏ¢¡£Ïê¼û×Ô¶¯Êý¾Ý¿âÕï¶Ï¼à¿Ø¡£

3.SQL Tuning Advisor allows a quick and efficient technique for optimizing SQL statements without modifying any statements. See "SQL Tuning Advisor".

sqlÓÅ»¯½¨ÒéÆ÷ ÌṩÁ˲»ÐÞ¸ÄsqlÓï¾äµÄÒ»¸ö¿ìËÙÓÐЧµÄsqlÓÅ»¯¼¼Êõ¡£Ïê¼û sqlÓÅ»¯½¨ÒéÆ÷¡£

4.SQLAccess Advisor provides advice on materialized views, indexes, and materialized view logs. See "Automatic SQL Tuning Features" and "Overview of the SQL Access Advisor in the DBMS_ADVISOR Package" for information on SQLAccess Advisor.

sql·ÃÎʽ¨ÒéÆ÷ ÌṩÁËÔÚÎﻯÊÓͼ£¬Ë÷Òý£¬ÎﻯÊÓͼÈÕÖ¾ÉϵÄһЩ½¨Òé¡£ ÇëÔĶÁ×Ô¶¯sqlÓÅ»¯ÌØÐÔºÍÊý¾Ý¿â½¨Òé°üÀïµÄsql·ÃÎʽ¨ÒéÆ÷¸ÅÊö¡£

5.End to End Application tracing identifies excessive workloads on the system by specific user, service, or application component. See "End to End Application Tracing".

¶Ëµ½¶ËµÄÓ¦ÓóÌÐò×·×ÙÆ÷Äܹ»Í¨¹ýÌØÊâÓû§·þÎñºÍÓ¦ÓóÌÐò×é¼þÀ´±êʶ³öϵͳÉϹý¶È¸ºÔصĵط½¡£Ïê¼û¶Ëµ½¶Ë³ÌÐò×·×Ù¡£

6.Server-generated alerts automatically provide notifications when impending problems are detected. See Oracle Database Administrator's Guide for information about monitoring the operation of the database with server-generated alerts.

µ±ÎÊÌâ±Æ½üµÄʱºò£¬·þÎñÆ÷²úÉúµÄ¸æ¾¯ÈÕÖ¾»á×Ô¶¯Í¨Öª¡£¹ØÓÚÓ÷þÎñÆ÷¸æ¾¯ÈÕÖ¾¼à¿ØÊý¾ÝÔËÐеĸü¶àÐÅÏ¢ Ïê¼û¡°oracleÊý¾Ý¿â¹ÜÀíÔ±Ö¸ÄÏ¡±¡£

7.Additional advisors that can be launched from Oracle Enterprise Manager, such as memory advisors to optimize memory for an instance. The memory advisors are commonly used when automatic memory management is not set up for the database. Other advisors are used to optimize mean time to recovery (MTTR), shrinking of segments, and undo tablespace settings. For information about using advisors that are available with Oracle Enterprise Manager, see Oracle Database 2 Day + Performance Tuning Guide.

oracleÆóÒµ¼¶¹ÜÀíÆ÷Äܹ»Ìṩ¶îÍâµÄ½¨Òé²Î¿¼ÐÅÏ¢£¬ÀýÈçÄڴ潨ÒéΪʵÀýÓÅ»¯ÄÚ´æ¡£µ±Ã»ÓÐΪÊý¾Ý¿âÉèÖÃ×Ô¶¯ÄÚ´æ¹ÜÀí µÄʱºò£¬Äڴ潨ÒéÆ÷ͨ³£±»Ê¹Óá£ÁíÍâһЩ½¨ÒéÆ÷±»ÓÃÀ´ÓÅ»¯»Ö¸´µÄƽ¾ùºÄʱʱ¼äºÍ¶ÎµÄÊÕËõºÍ»Ø¹ö¶Î¿Õ¼äÉèÖá£ÈôÒª¹ØÓÚʹÓÃoracleÆóÒµ¹ÜÀíÆ÷¹ËÎʵĸü¶àÐÅÏ¢£¬ÇëÔĶÁ¡±Á½ÌìÕÆÎÕoracle+ÐÔÄܵ÷ÓÅÖ¸ÄÏ¡±¡£

8.The Database Performance page in Oracle Enterprise Manager displays host, instance service time, and throughput information for real time monitoring and diagnosis. The page can be set to refresh automatically in selected intervals or manually. For information about the Database Performance page, see Oracle Database 2 Day + Performance Tuning Guide.

Êý¾Ý¿âÆóÒµ¹ÜÀíÆ÷ÀïµÄÊý¾Ý¿âÐÔÄܱʼÇÏÔʾÁËÖ÷»ú ʵÀý·þÎñʱ¼ä¡¢ÊµÊ±µÄÕï¶ÏÐÅÏ¢ºÍÍÌÍÂÁ¿¡£Õâ¸ö±Ê¼ÇÄܹ»ÔÚÑ¡¶¨µÄʱ¼ä¶ÎÄÚ×Ô¶¯Ë¢Ð»òÕßÈ˹¤Ë¢Ð¡£¹ØÓÚÐÔÄܵ÷Óűʼǵĸü¶àÐÅÏ¢ ÇëÔĶÁ¡±2ÌìÕÆÎÕoracleÊý¾Ý¿â+Êý¾Ý¿âµ÷ÓÅÖ¸ÄÏ¡±¡£

1.2.2¶îÍâµÄÊý¾Ý¿â¹¤¾ß

This section describes additional Oracletools that can be used for determining performance problems.

Õⲿ·ÖÃèÊöÁËÄܹ»±»ÓÃÀ´È·¶¨oracleÐÔÄÜÎÊÌâµÄ¶îÍ⹤¾ß.

1.2.2.1 V$¿ªÍ·µÄÐÔÄÜÊÓͼ

The V$ views are the performanceinformation sources used by all Oracle performance tuning tools.The V$ views are based on memory structures initialized at instancestartup. The memory structures, and the views that represent them, areautomatically maintained by Oracle throughout the life of the instance.See Chapter 10, "Instance Tuning Using PerformanceViews" for information diagnosing tuning problems usingthe V$ performance views.

V$ÊÓͼÊÇËùÓеÄoracleÐÔÄܵ÷ÓŹ¤¾ßʹÓõÄÐÔÄÜÐÅÏ¢µÄÔ´Í·¡£V$ÊÓͼ»ùÓÚʵÀýÆô¶¯Ê±±»³õʼ»¯µÄÄÚ´æ½á¹¹¡£ÄÚ´æ½á¹¹ºÍ´ú±íËûÃǵÄÊÓͼÔÚʵÀýµÄÕû¸öÉúÃüÖÜÆÚ»á±»oracle×Ô¶¯Î¬»¤¡£ÇëÔĶÁ 10Õ½ڡ°Ê¹ÓÃÐÔÄÜÊÓͼµÄʵÀýÓÅ»¯¡±À´»ñȡʹÓÃV$ÐÔÄÜÊÓͼÀ´Õï¶Ïµ÷ÓÅÎÊÌâµÄ¸ü¶àÐÅÏ¢¡£

See Also:

Oracle Database Reference for informationabout dynamic performance views

ͬ¼û£º

oracleÊý¾Ý¿âÖ¸ÄÏÀ´»ñÈ¡¹ØÓÚ¶¯Ì¬ÐÔÄÜÊÓͼµÄ¸ü¶àÐÅÏ¢¡£

Note:

×¢Ò⣺

Oracle recommends using the AutomaticWorkload Repository to gather performance data. These tools have been designedto capture all of the data needed for performance analysis.

oracleÍÆ¼öʹÓÃ×Ô¶¯¹¤×÷ÐÅÏ¢¿âÀ´ÊÕ¼¯ÐÔÄÜÊý¾Ý¡£ÕâЩ¹¤¾ßÒѾ­±»Éè¼ÆÀ´²¶»ñÐÔÄÜ·ÖÎöËùÐèÒªµÄËùÓÐÊý¾Ý¡£

   
2755 ´Îä¯ÀÀ       27
Ïà¹ØÎÄÕÂ

»ùÓÚEAµÄÊý¾Ý¿â½¨Ä£
Êý¾ÝÁ÷½¨Ä££¨EAÖ¸ÄÏ£©
¡°Êý¾Ýºþ¡±£º¸ÅÄî¡¢ÌØÕ÷¡¢¼Ü¹¹Óë°¸Àý
ÔÚÏßÉ̳ÇÊý¾Ý¿âϵͳÉè¼Æ ˼·+Ч¹û
 
Ïà¹ØÎĵµ

GreenplumÊý¾Ý¿â»ù´¡Åàѵ
MySQL5.1ÐÔÄÜÓÅ»¯·½°¸
ijµçÉÌÊý¾ÝÖÐ̨¼Ü¹¹Êµ¼ù
MySQL¸ßÀ©Õ¹¼Ü¹¹Éè¼Æ
Ïà¹Ø¿Î³Ì

Êý¾ÝÖÎÀí¡¢Êý¾Ý¼Ü¹¹¼°Êý¾Ý±ê×¼
MongoDBʵս¿Î³Ì
²¢·¢¡¢´óÈÝÁ¿¡¢¸ßÐÔÄÜÊý¾Ý¿âÉè¼ÆÓëÓÅ»¯
PostgreSQLÊý¾Ý¿âʵսÅàѵ
×îл¼Æ»®
DeepSeekÔÚÈí¼þ²âÊÔÓ¦ÓÃʵ¼ù 4-12[ÔÚÏß]
DeepSeek´óÄ£ÐÍÓ¦Óÿª·¢Êµ¼ù 4-19[ÔÚÏß]
UAF¼Ü¹¹ÌåϵÓëʵ¼ù 4-11[±±¾©]
AIÖÇÄÜ»¯Èí¼þ²âÊÔ·½·¨Óëʵ¼ù 5-23[ÉϺ£]
»ùÓÚ UML ºÍEA½øÐзÖÎöÉè¼Æ 4-26[±±¾©]
ÒµÎñ¼Ü¹¹Éè¼ÆÓ뽨ģ 4-18[±±¾©]

MySQLË÷Òý±³ºóµÄÊý¾Ý½á¹¹
MySQLÐÔÄܵ÷ÓÅÓë¼Ü¹¹Éè¼Æ
SQL ServerÊý¾Ý¿â±¸·ÝÓë»Ö¸´
ÈÃÊý¾Ý¿â·ÉÆðÀ´ 10´óDB2ÓÅ»¯
oracleµÄÁÙʱ±í¿Õ¼äдÂú´ÅÅÌ
Êý¾Ý¿âµÄ¿çƽ̨Éè¼Æ


²¢·¢¡¢´óÈÝÁ¿¡¢¸ßÐÔÄÜÊý¾Ý¿â
¸ß¼¶Êý¾Ý¿â¼Ü¹¹Éè¼ÆÊ¦
HadoopÔ­ÀíÓëʵ¼ù
Oracle Êý¾Ý²Ö¿â
Êý¾Ý²Ö¿âºÍÊý¾ÝÍÚ¾ò
OracleÊý¾Ý¿â¿ª·¢Óë¹ÜÀí


GE Çø¿éÁ´¼¼ÊõÓëʵÏÖÅàѵ
º½Ìì¿Æ¹¤Ä³×Ó¹«Ë¾ Nodejs¸ß¼¶Ó¦Óÿª·¢
ÖÐÊ¢Òæ»ª ׿Խ¹ÜÀíÕß±ØÐë¾ß±¸µÄÎåÏîÄÜÁ¦
ijÐÅÏ¢¼¼Êõ¹«Ë¾ PythonÅàѵ
ij²©²ÊITϵͳ³§ÉÌ Ò×ÓÃÐÔ²âÊÔÓëÆÀ¹À
ÖйúÓÊ´¢ÒøÐÐ ²âÊÔ³ÉÊì¶ÈÄ£Ðͼ¯³É(TMMI)
ÖÐÎïÔº ²úÆ·¾­ÀíÓë²úÆ·¹ÜÀí