30¸öOracleÓï¾äÓÅ»¯¹æÔòÏê½â
1.Ñ¡ÓÃÊʺϵÄOracleÓÅ»¯Æ÷
OracleµÄÓÅ»¯Æ÷¹²ÓÐ3ÖÖ£º
a.RULE(»ùÓÚ¹æÔò)
b.COST(»ùÓڳɱ¾)
c.CHOOSE(Ñ¡ÔñÐÔ)
ÉèÖÃȱʡµÄÓÅ»¯Æ÷£¬¿ÉÒÔͨ¹ý¶Ôinit.oraÎļþÖÐOPTIMIZER_MODE²ÎÊýµÄ
¸÷ÖÖÉùÃ÷£¬ÈçRULE¡¢COST¡¢CHOOSE¡¢ALL_ROWS¡¢FIRST_ROWS¡£Ä㵱ȻҲÔÚSQL¾ä¼¶»òÊǻỰ(session)¼¶¶ÔÆä½øÐи²
¸Ç¡£
ΪÁËʹÓûùÓڳɱ¾µÄÓÅ»¯Æ÷(CBO£¬Cost-Based
Optimizer)£¬Äã±ØÐë¾³£ÔËÐÐanalyzeÃüÁÒÔÔö¼ÓÊý¾Ý¿âÖеĶÔÏóͳ¼ÆÐÅÏ¢(object statistics)µÄ׼ȷÐÔ¡£
Èç¹ûÊý¾Ý¿âµÄÓÅ»¯Æ÷ģʽÉèÖÃΪѡÔñÐÔ(CHOOSE)£¬ÄÇôʵ¼ÊµÄÓÅ»¯Æ÷ģʽ½«ºÍÊÇ·ñÔËÐÐ
¹ýanalyzeÃüÁîÓйء£Èç¹ûtableÒѾ±»analyze¹ý£¬ÓÅ»¯Æ÷ģʽ½«×Ô¶¯³ÉΪCBO£¬·´Ö®£¬Êý¾Ý¿â½«²ÉÓÃRULEÐÎʽµÄÓÅ»¯Æ÷¡£
ÔÚȱʡÇé¿öÏ£¬Oracle²ÉÓÃCHOOSEÓÅ»¯Æ÷£¬ÎªÁ˱ÜÃâÄÇЩ²»±ØÒªµÄÈ«±íɨÃè
(full table scan)£¬Äã±ØÐ뾡Á¿±ÜÃâʹÓÃCHOOSEÓÅ»¯Æ÷£¬¶øÖ±½Ó²ÉÓûùÓÚ¹æÔò»òÕß»ùÓڳɱ¾µÄÓÅ»¯Æ÷¡£
2.·ÃÎÊTableµÄ·½Ê½Oracle²ÉÓÃÁ½ÖÖ·ÃÎʱíÖмǼµÄ·½Ê½£º
a.È«±íɨÃè
È«±íɨÃè¾ÍÊÇ˳ÐòµØ·ÃÎʱíÖÐÿÌõ¼Ç¼¡£Oracle²ÉÓÃÒ»´Î¶ÁÈë¶à¸öÊý¾Ý¿é
(database block)µÄ·½Ê½ÓÅ»¯È«±íɨÃè¡£
b. ͨ¹ýROWID·ÃÎʱí
Äã¿ÉÒÔ²ÉÓûùÓÚROWIDµÄ·ÃÎÊ·½Ê½Çé¿ö£¬Ìá¸ß·ÃÎʱíµÄЧÂÊ£¬ROWID°üº¬Á˱íÖмǼµÄ
ÎïÀíλÖÃÐÅÏ¢……Oracle²ÉÓÃË÷Òý(INDEX)ʵÏÖÁËÊý¾ÝºÍ´æ·ÅÊý¾ÝµÄÎïÀíλÖÃ(ROWID)Ö®¼äµÄÁªÏµ¡£Í¨³£Ë÷ÒýÌṩÁË¿ìËÙ·ÃÎÊROWIDµÄ·½
·¨£¬Òò´ËÄÇЩ»ùÓÚË÷ÒýÁеIJéѯ¾Í¿ÉÒԵõ½ÐÔÄÜÉϵÄÌá¸ß¡£
3.¹²ÏíSQLÓï¾ä
ΪÁ˲»Öظ´½âÎöÏàͬµÄSQLÓï¾ä£¬ÔÚµÚÒ»´Î½âÎöÖ®ºó£¬Oracle½«SQLÓï¾ä´æ·ÅÔÚÄÚ´æ
ÖС£Õâ¿éλÓÚϵͳȫ¾ÖÇøÓòSGA(system global area)µÄ¹²Ïí³Ø(shared buffer
pool)ÖеÄÄÚ´æ¿ÉÒÔ±»ËùÓеÄÊý¾Ý¿âÓû§¹²Ïí¡£Òò´Ë£¬µ±ÄãÖ´ÐÐÒ»¸öSQLÓï¾ä(ÓÐʱ±»³ÆΪһ¸öÓαê)ʱ£¬Èç¹ûËüºÍ֮ǰµÄÖ´ÐйýµÄÓï¾äÍêÈ«Ïà
ͬ£¬Oracle¾ÍÄܺܿì»ñµÃÒѾ±»½âÎöµÄÓï¾äÒÔ¼°×îºÃµÄÖ´Ðз¾¶¡£OracleµÄÕâ¸ö¹¦ÄÜ´ó´óµØÌá¸ßÁËSQLµÄÖ´ÐÐÐÔÄܲ¢½ÚÊ¡ÁËÄÚ´æµÄʹÓá£
¿ÉϧµÄÊÇOracleÖ»¶Ô¼òµ¥µÄ±íÌṩ¸ßËÙ»º³å(cache buffering)
£¬Õâ¸ö¹¦Äܲ¢²»ÊÊÓÃÓÚ¶à±íÁ¬½Ó²éѯ¡£
Êý¾Ý¿â¹ÜÀíÔ±±ØÐëÔÚinit.oraÖÐΪÕâ¸öÇøÓòÉèÖúÏÊʵIJÎÊý£¬µ±Õâ¸öÄÚ´æÇøÓòÔ½´ó£¬¾Í
¿ÉÒÔ±£Áô¸ü¶àµÄÓï¾ä£¬µ±È»±»¹²ÏíµÄ¿ÉÄÜÐÔÒ²¾ÍÔ½´óÁË¡£
µ±ÄãÏòOracleÌá½»Ò»¸öSQLÓï¾ä£¬Oracle»áÊ×ÏÈÔÚÕâ¿éÄÚ´æÖвéÕÒÏàͬµÄÓï¾ä¡£
ÕâÀïÐèҪעÃ÷µÄÊÇ£¬Oracle¶ÔÁ½Õß²ÉÈ¡µÄÊÇÒ»ÖÖÑϸñÆ¥Å䣬Ҫ´ï³É¹²Ïí£¬SQLÓï¾ä±ØÐë
ÍêÈ«ÏàÍ
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
Author: rainnyzhong
Date:2010-1-15
1£® Ö¢×´ÃèÊö£º
FALB12´ÓEXCEL IMPORT DATAµ½DB£¬Ô¤¼ÆÊÂÎñ»áÔËÐÐ1¸ö¶àСʱ£¬ÔÚ¿ªÊ¼²Ù×÷ºó40·ÖÖÓ×óÓÒ£¬ORACLE¹ÒËÀ£¬ÈκÎÓû§¶¼²»¿ÉÒÔÔٵǽÁË¡£
2£® ·ÖÎö
£¨1£© ÏÂÃæÊǹÒËÀʱOSµÄ×ÊÔ´×´¿ö£º
09:37:54 up 73 ......
ÔÚORACLEÊý¾Ý¿âÖÐ,ÐèÒª¶ÔSQLÓï¾ä½øÐÐÓÅ»¯µÄ»°ÐèÒªÖªµÀÆäÖ´Ðмƻ®,´Ó¶øÕë¶ÔÐԵĽøÐе÷Õû.ORACLEµÄÖ´Ðмƻ®µÄ»ñµÃÓм¸ÖÖ·½·¨,ÏÂÃæ¾ÍÀ´×ܽáÏÂ
1¡¢EXPLAINµÄʹÓÃ
Oracle RDBMSÖ´ÐÐÿһÌõSQLÓï¾ä£¬¶¼±ØÐë¾¹ýOracleÓÅ»¯Æ÷µÄÆÀ¹À¡£ËùÒÔ£¬Á˽âÓÅ»¯Æ÷ÊÇÈçºÎÑ¡Ôñ(ËÑË÷)·¾¶ÒÔ¼°Ë÷ÒýÊÇÈçºÎ±»Ê¹Óõģ¬¶ÔÓÅ»¯SQLÓï ......
ÔÎĵØÖ·£º
http://blog.sina.com.cn/s/blog_60e4205e0100esaf.html
ÕÒ³öÕýÔÚÖ´ÐеÄJOB±àºÅ¼°Æä»á»°±àºÅ
SELECT SID,JOB from
DBA_JOBS_RUNNING;
Í£Ö¹¸ÃJOBµÄÖ´ÐÐ
SELECT SID,SERIAL# from
V$SESSION WHERE ......