¡¾×ª¡¿Oracle SQLµÄÓ²½âÎöºÍÈí½âÎö
˵µ½Èí½âÎö£¨soft prase
£©ºÍÓ²½âÎö£¨
hard prase
£©£¬¾Í²»Äܲ»ËµÒ»ÏÂ
Oracle
¶Ô
sql
µÄ´¦Àí¹ý³Ì¡£µ±Äã·¢³öÒ»Ìõ
sql
Óï¾ä½»¸¶
Oracle
£¬ÔÚÖ´ÐкͻñÈ¡½á¹ûÇ°£¬
Oracle
¶Ô´Ë
sql
½«½øÐм¸¸ö²½ÖèµÄ´¦Àí¹ý³Ì£º
1¡¢Óï·¨¼ì²é£¨
syntax check
£©
¼ì²é´Ësql
µÄƴдÊÇ·ñÓï·¨¡£
2¡¢ÓïÒå¼ì²é£¨
semantic check
£©
ÖîÈç¼ì²ésql
Óï¾äÖеķÃÎʶÔÏóÊÇ·ñ´æÔÚ¼°¸ÃÓû§ÊÇ·ñ¾ß±¸ÏàÓ¦µÄȨÏÞ¡£
3¡¢¶Ô
sql
Óï¾ä½øÐнâÎö£¨
prase
£©
ÀûÓÃÄÚ²¿Ëã·¨¶Ôsql
½øÐнâÎö£¬Éú³É½âÎöÊ÷£¨
parse tree
£©¼°Ö´Ðмƻ®£¨
execution plan
£©¡£
4¡¢Ö´ÐÐ
sql
£¬·µ»Ø½á¹û£¨
execute and return
£©
ÆäÖУ¬Èí¡¢Ó²½âÎö¾Í·¢ÉúÔÚµÚÈý¸ö¹ý³ÌÀï¡£
OracleÀûÓÃÄÚ²¿µÄ
hash
Ëã·¨À´È¡µÃ¸Ã
sql
µÄ
hash
Öµ£¬È»ºóÔÚ
library cache
Àï²éÕÒÊÇ·ñ´æÔÚ¸Ã
hash
Öµ£»
¼ÙÉè´æÔÚ£¬Ôò½«´Ësql
Óë
cache
ÖеĽøÐбȽϣ»
¼ÙÉè“
Ïàͬ
”
£¬¾Í½«ÀûÓÃÒÑÓеĽâÎöÊ÷ÓëÖ´Ðмƻ®£¬¶øÊ¡ÂÔÁËÓÅ»¯Æ÷µÄÏà¹Ø¹¤×÷¡£ÕâÒ²¾ÍÊÇÈí½âÎöµÄ¹ý³Ì¡£
³ÏÈ»£¬Èç¹ûÉÏÃæµÄ2
¸ö¼ÙÉèÖÐÈÎÓÐÒ»¸ö²»³ÉÁ¢£¬ÄÇôÓÅ»¯Æ÷¶¼½«½øÐд´½¨½âÎöÊ÷¡¢Éú³ÉÖ´Ðмƻ®µÄ¶¯×÷¡£Õâ¸ö¹ý³Ì¾Í½ÐÓ²½âÎö¡£
´´½¨½âÎöÊ÷¡¢Éú³ÉÖ´Ðмƻ®¶ÔÓÚsql
µÄÖ´ÐÐÀ´ËµÊÇ¿ªÏú°º¹óµÄ¶¯×÷£¬ËùÒÔ£¬Ó¦µ±¼«Á¦±ÜÃâÓ²½âÎö£¬¾¡Á¿Ê¹ÓÃÈí½âÎö¡£
Õâ¾ÍÊÇÔںܶàÏîÄ¿ÖУ¬³«µ¼¿ª·¢Éè¼ÆÈËÔ±¶Ô¹¦ÄÜÏàͬµÄ´úÂëҪŬÁ¦±£³Ö´úÂëµÄÒ»ÖÂÐÔ£¬ÒÔ¼°ÒªÔÚ³ÌÐòÖжàʹÓð󶨱äÁ¿µÄÔÒò¡£
/****************************************************/
´ó¼Ò¶¼ÔÚ˵ÔÚSql
ÖÐʹÓÃÁË
Bind Var
£¨°ó¶¨±äÁ¿£©»áÌá¸ß²»ÉÙÐÔÄÜ£¬ÄÇËûµ½µ×ÊÇÈçºÎÌá¸ßÐÔÄܵÄÄØ£¿
ʹÓÃÁËBind Var
ÄÜÌá¸ßÐÔÄÜÖ÷ÒªÊÇÒòΪÕâÑù×ö¿ÉÒÔ¾¡Á¿±ÜÃâ²»±ØÒªµÄÓ²·ÖÎö£¨
Hard Parse
£©¶ø½ÚÔ¼ÁËʱ¼ä£¬Í¬Ê±½ÚÔ¼ÁË´óÁ¿µÄ
CPU
×ÊÔ´¡£
µ±Ò»¸öClient
Ìá½»Ò»Ìõ
Sql
¸ø
Or
Ïà¹ØÎĵµ£º
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
ѧϰOracle DBAÒ²°ë¸ö¶àѧÆÚÁË£¬½ñÌìÃÍÈ»²Å·¢ÏÖ£¬ÔÀ´ÎÒµÄÊ黹ÊǺÜеģ¬ÉϿβÙ×÷ʱºòÒ²Ö»ÊÇÖªµÀ´ó¸ÅÔõô×ö£¬µ«ÊÇÒªÕæµÄÈ«²¿×Ô¼º×ö£¬¶ø²»È¥·Ê黹ÊÇÓÐÒ»¶¨µÄÄѶȵģ¬ËùÒÔÄØ£¬½ñÌ쿪ʼ½«DBA´ÓÍ·¸´Ï°Ò»±é£¬Í¬Ê±ÔÙ²Ù×÷Ò»±é¡£
µÚÒ»Õ£¬Ñ§µÄÊÇOracleµÄÌåϵ½á¹¹£ ......
ÔÚWhere×Ó¾äÖУ¬¿ÉÒÔ¶Ôdatetime¡¢char¡¢varchar×Ö¶ÎÀàÐ͵ÄÁÐÓÃLike×Ó¾äÅäºÏͨÅä·ûÑ¡È¡ÄÇЩ“ºÜÏñ...”µÄÊý¾Ý¼Ç¼£¬ÒÔÏÂÊÇ¿ÉʹÓõÄͨÅä·û£º
% Áã»òÕ߶à¸ö×Ö·û
_ µ¥Ò»ÈκÎ×Ö·û£¨Ï»®Ïߣ©
\ ÌØÊâ×Ö·û
[] ÔÚijһ·¶Î§ÄÚµÄ×Ö·û£¬Èç ......
ÔÚsql²éѯ·ÖÎöÆ÷ÀïÃæÊDz»ÄÜÖ±½ÓÔËÐÐcmdÃüÁîµÄ
µ«ÊÇSQL¸ø³öÁËÒ»¸ö½Ó¿Ú
--´ò¿ª¸ß¼¶ÉèÖÃ
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
--´ò¿ªxp_cmdshellÀ©Õ¹´æ´¢¹ý³Ì
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGURE
Ê×ÏÈ ´ò¿ªÒ»Ð©ÅäÖÃ
È»ºóÖ´ÐÐÄãÒªÔËÐÐcmdÃüÁî
exec master..xp_cmdshell 'net star ......
Ò»²½Ò»²½Ñ§Linq to sql£¨Ò»£©£ºÔ¤±¸ÖªÊ¶
Ò»²½Ò»²½Ñ§Linq to sql£¨¶þ£©£ºDataContextÓëʵÌå
Ò»²½Ò»²½Ñ§Linq to sql£¨Èý£©£ºÔöɾ¸Ä
Ò»²½Ò»²½Ñ§Linq to sql£¨ËÄ£©£º²éѯ¾ä·¨
Ò»²½Ò»²½Ñ§Linq to sql£¨Î壩£º´æ´¢¹ý³Ì
Ò»²½Ò»²½Ñ§Linq to sql£¨Áù£©£ºÌ½¾¿ÌØÐÔ
Ò»²½Ò»²½Ñ§Linq to sql£¨Æߣ©£º²¢·¢ÓëÊÂÎñ ......