ORACLE SQLÐÔÄÜÓÅ»¯(ÄÚ²¿Åàѵ×ÊÁÏ)
ORACLE SQLÐÔÄÜÓÅ»¯
ORACLE SQLÐÔÄÜÓÅ»¯ÏµÁÐ (Ò»)
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¶ÔÁ½Õ
Ïà¹ØÎĵµ£º
Oracle Enterprise Manager Oracle EMÊÇÓû§°²×°Oracle£¬´´½¨ÁËÊý¾Ý¿â²¢ÅäÖúÃÍøÂç×ÊÔ´ºó£¬Oracle¸½´ø°²×°µÄÒ»¸öÊý¾Ý¿â¹ÜÀíÈí¼þ¡£Í¬Ê±£¬EMÒ²Ìṩ¶ÔÐÔÄܵ÷ÊÔÓаïÖúµÄ¹¤¾ß£¬ÈçSQL*LoaderºÍRecovery Manager £¨RMAN£©µÈ¡£ Oracle Diagnostics Pack (ODP) ODPÓ¦¸ÃËãÊÇOracleÊý¾Ý¿â»·¾³ÐÔÄܵ÷ÊÔµÄ×îÖ÷ÒªºÍ×îÓÐЧµÄ¹¤¾ß£¬ËüÌá¹ ......
ORACLEÅàѵ(OCA)ÈÏÖ¤½éÉÜ
Oracle10g Certified Associate (OCA) Oracle ÈÏ֤רԱ¡£
¿¼ÊԳɼ¨Í¨¹ýÄÜ»ñµÃOracle¹«Ë¾ÎªÄú°ä·¢µÄÈ«ÇòÈÏÖ¤µÄÓ¢ÎÄOCAÖ¤Êé¡£OCAÓÉOracle¹«Ë¾³öÌâ¡£
¸ÃÖ¤Êé¿É×÷Ϊ¸÷ÆóÊÂÒµµ¥Î»Êý¾Ý¿â¹ÜÀíÈËÔ±ÉϸڵÄÒÀ¾Ý¡£
Ä¿Ç°ÒѳÉΪ¸÷IT¹«Ë¾¼°Ïà¹ØÆóÒµÕùÏྺƸµÄÊý¾Ý¿â¹ÜÀíά»¤È˲ţ¬ÊÇÊý¾Ý¿âά»¤¹ÜÀíÈËÔ±(DBA) ......
GROUPINGº¯Êý¿ÉÒÔ½ÓÊÜÒ»ÁУ¬·µ»Ø0»òÕß1¡£Èç¹ûÁÐֵΪ¿Õ£¬ÄÇôGROUPING()·µ»Ø1£»Èç¹ûÁÐÖµ·Ç¿Õ£¬ÄÇô·µ»Ø0¡£GROUPINGÖ»ÄÜÔÚʹÓÃROLLUP»òCUBEµÄ²éѯÖÐʹÓᣵ±ÐèÒªÔÚ·µ»Ø¿ÕÖµµÄµØ·½ÏÔʾij¸öֵʱ£¬GROUPING()¾Í·Ç³£ÓÐÓá£
¹ØÓÚROLLUPºÍCUBEº¯ÊýµÄʹÓã¬Çë²Î¼ûÎÒµÄÁíһƪÎÄÕ¡£
http://blog.csdn.net/wh62592855/archive/2009/1 ......
1.¼ò½é
ÔÚ9i֮ǰ£¬²ÎÊýÎļþÖ»ÓÐÒ»ÖÖ£¬ËüÊÇÎı¾¸ñʽµÄ£¬³ÆΪpfile£¬ÔÚ9i¼°ÒÔºóµÄ°æ±¾ÖУ¬ÐÂÔöÁË·þÎñÆ÷²ÎÊýÎļþ,³ÆΪspfile,ËüÊǶþ½øÖƸñʽµÄ¡£ÕâÁ½ÖÖ²ÎÊýÎļþ¶¼ÊÇÓÃÀ´´æ´¢²Î ÊýÅäÖÃÒÔ¹©oracle¶ÁÈ¡µÄ£¬µ«Ò²Óв»Í¬µã£¬×¢ÒâÒÔϼ¸µã£º
1)pfileÊÇÎı¾Îļþ£¬spfileÊǶþ½øÖÆÎļþ£»
2) ¶ÔÓÚ²ÎÊýµÄÅäÖã¬pfile¿ÉÒÔÖ±½ÓÒÔÎı¾±à¼Æ ......