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¸øOracleºó£¬Oracle Ê×ÏÈ»á¶ÔÆä½øÐнâÎö£¨Parse£©£¬È»ºó½«½âÎö½á¹ûÌá½»¸øÓÅ»¯Æ÷£¨Optimiser£©À´½øÐÐÓÅ»¯¶øÈ¡µÃOracleÈÏΪµÄ×î
Ïà¹ØÎĵµ£º
oracleµÄÌåϵºÜÅÓ´ó£¬ÒªÑ§Ï°Ëü£¬Ê×ÏÈÒªÁ˽âoracleµÄ¿ò¼Ü¡£ÔÚÕâÀ¼òÒªµÄ½²Ò»ÏÂoracleµÄ¼Ü¹¹£¬ÈóõѧÕ߶ÔoracleÓÐÒ»¸öÕûÌåµÄÈÏʶ¡£
¡¡¡¡1¡¢ÎïÀí½á¹¹£¨ÓÉ¿ØÖÆÎļþ¡¢Êý¾ÝÎļþ¡¢ÖØ×öÈÕÖ¾Îļþ¡¢²ÎÊýÎļþ¡¢¹éµµÎļþ¡¢ÃÜÂëÎļþ×é³É£©
¡¡¡¡¿ØÖÆÎļþ£º°üº¬Î¬»¤ºÍÑéÖ¤Êý¾Ý¿âÍêÕûÐԵıØÒªÐÅÏ¢¡¢ÀýÈ磬¿ØÖÆÎļþÓÃÓÚʶ±ðÊý¾ÝÎļ ......
ÔÚʹÓÃSQL*PlusÉú³É±¨¸æÎļþµÄʱºò£¬ÍùÍù»áÒòΪÆäĬÈϵÄÉèÖõ¼ÖÂÊä³öµÄ½á¹û·Ç³£µÄûÓпɶÁÐÔ£¬ÏÂÃæ½éÉÜÒ»¸öÈÕ³£ÖлᱻÓõ½µÄÒ»¸ö½Å±¾£¬ÆäÖаüº¬Ò»Ð©¸ñʽ»¯
Êä³öµÄsetÃüÁî
£¬ÎªÁË·½±ãÀí½â£¬ÎÒ»áÔÚÿһÌõsetÃüÁîÖ®ºó½ô¸ú×ÅÒ»¸ö¼òµ¥µÄ½âÊÍ£¬ÇëÂýÂýÌå»á¡£
sqlplus -s user_name/user_password << EOF >/dev/n ......
1.½¨±í
create table temp(rq varchar(10),shengfu nchar(1))
2.²åÈëÊý¾Ý
insert into temp values('2005-05-09','ʤ')
insert into temp values('2005-05-09','ʤ')
insert into temp values('2005-05-09','¸º')
insert into temp values('2005-05-09','¸º')
insert into temp values('2005-05-10','ʤ')
insert i ......
ÒòΪÑöÍûORACLE£¬ËùÒÔÒ»Ö±¶¼ÒÔΪSQL SERVERºÜ±¿¡£
¾Ý´«SQL 2005ÓÐÁËRowIDµÄ¶«Î÷£¬¿ÉÒÔ½â¾öTOPÅÅÐòµÄÎÊÌâ¡£¿Éϧ»¹Ã»Óлú»áÌåÑé¡£ÔÚSQL 2000ÖÐд´æ´¢¹ý³Ì£¬×Ü»áÓöµ½ÐèÒªTOPµÄµØ·½£¬¶øÒ»µ©Óöµ½TOP£¬ÒòΪû°ì·¨°ÑTOPºóÃæµÄÊý×Ö×÷Ϊ±äÁ¿Ð´µ½Ô¤±àÒëµÄÓï¾äÖÐÈ¥£¬ËùÒÔÖ»Äܹ»Ê¹Óù¹Ôì SQL£¬Ê¹ÓÃExecÀ´Ö´ÐС£²»ËµÐ§ÂʵÄÎÊÌ⣠......
ÈçºÎ°ÑAccessת³ÉSQL ServerµÄ·½·¨½éÉÜ
ºÜ¶àÅóÓÑÏëÓÃSQL 2000Êý¾Ý¿âµÄ±à³Ì·½·¨£¬µ«ÊÇÈ´ÓÖ¿àÓÚ×Ô¼ºÊÇѧAccessµÄ£¬¶ÔSQLÖ»ÊÇÒ»µãµãµÄÁ˽â¶øÒÑ£¬ÕâÀïÎÒ¸ø´ó¼ÒÌṩÒÔϲο¼---½«Accessת»¯³ÉSQL 2000µÄ·½·¨ºÍ×¢ÒâÊÂÏî¡£Ê×ÏÈ£¬ÎÒ˵µÄÊÇÔÚAccess 2000£¬SQL 2000Ö®¼äת»»£¬ÆäËûµÄÎÒÒ²»¹Ã»Óг¢ÊÔ¹ý£¬Ï£ ......