ORACLE SQL ÓÅ»¯µÄÈô¸É·½·¨
Ò»¡¢ ÏȽéÉÜÒ»ÏÂoracleµÄSGA£ºÊý¾Ý¿âµÄϵͳȫ¾ÖÇø£¬SGAÖ÷ÒªÓÉÈý²¿·Ö¹¹³É£º¹²Ïí³Ø¡¢Êý¾Ý»º³åÇø¡¢ÈÕÖ¾»º³åÇø¡£ 1¡¢¹²Ïí³ØÓÖÓÉÁ½²¿·Ö¹¹³É£º¹²ÏíSQLÇøºÍÊý¾Ý×ֵ仺³åÇø¡£¹²ÏíSQLÇøרÃÅ´æ·ÅÓû§SQLÃüÁoracleʹÓÃ×î½ü×îÉÙʹÓõÈÓÅÏȼ¶Ëã·¨À´¸üи²¸Ç£»Êý¾Ý×ֵ仺³åÇø£¨library cache£©´æ·ÅÊý¾Ý¿âÔËÐеĶ¯Ì¬ÐÅÏ¢¡£Êý¾Ý¿âÔËÐÐÒ»¶Îʱ¼äºó£¬DBAÐèÒª²é¿´ÕâЩÄÚ´æÇøÓòµÄÃüÖÐÂÊÒÔ´ÓÊý¾Ý¿â½Ç¶È¶ÔÊý¾Ý¿âÐÔÄܵ÷ÓÅ¡£Í¨¹ýÖ´ÐÐÏÂÊöÓï¾ä²é¿´£º
select (sum(pins - reloads)) / sum(pins) "Lib Cache" from v$librarycache;
--²é¿´¹²ÏíSQLÇøµÄÖØÓÃÂÊ£¬×îºÃÔÚ90£¥ÒÔÉÏ£¬·ñÔòÐèÒªÔö¼Ó¹²Ïí³ØµÄ´óС¡£
select (sum(gets - getmisses - usage - fixED)) / sum(gets) "Row Cache" from v$rowcache;
--²é¿´Êý¾Ý×ֵ仺³åÇøµÄÃüÖÐÂÊ£¬×îºÃÔÚ90£¥ÒÔÉÏ£¬·ñÔòÐèÒªÔö¼Ó¹²Ïí³ØµÄ´óС¡£
2¡¢ Êý¾Ý»º³åÇø£º´æ·ÅsqlÔËÐнá¹ûץȡµ½µÄdata block£»
SELECT name, value from v$sysstat WHERE name IN ('db block gets', 'consistent gets','physical reads');
-- ²é¿´Êý¾Ý¿âÊý¾Ý»º³åÇøµÄʹÓÃÇé¿ö¡£²éѯ³öÀ´µÄ½á¹û¿ÉÒÔ¼ÆËã³öÀ´Êý¾Ý»º³åÇøµÄʹÓÃÃüÖÐÂÊ£½1 - ( physical reads / (db block gets + consistent gets) )¡£ÃüÖÐÂÊÓ¦¸ÃÔÚ90£¥ÒÔÉÏ£¬·ñÔòÐèÒªÔö¼ÓÊý¾Ý»º³åÇøµÄ´óС¡£
3¡¢ ÈÕÖ¾»º³åÇø£º´æ·ÅÊý¾Ý¿âÔËÐÐÉú³ÉµÄÈÕÖ¾¡£
select name,value from v$sysstat where name in ('redo entries','redo log space requests');
--²é¿´ÈÕÖ¾»º³åÇøµÄʹÓÃÇé¿ö¡£²éѯ³öµÄ½á¹û¿ÉÒÔ¼ÆËã³öÈÕÖ¾»º³åÇøµÄÉêÇëʧ°ÜÂÊ£ºÉêÇëʧ°ÜÂÊ£½requests/entries£¬ÉêÇëʧ°ÜÂÊÓ¦¸Ã½Ó½üÓÚ0£¬·ñÔò˵Ã÷ÈÕÖ¾»º³åÇø¿ªÉè̫С£¬ÐèÒªÔö¼ÓORACLEÊý¾Ý¿âµÄÈÕÖ¾»º³åÇø¡£
¶þ£®SqlÓï¾äµÄÖ´Ðв½Ö裺
Á˽âsqlµÄÖ´Ðв½ÖèÓÐÀûÓÚ¸üºÃµÄÓÅ»¯ËüÃÇ£¬Ã¿ÌõsqlÓï¾äÖ´ÐÐʱ¶¼Òª¾ÀúÒÔϼ¸²½£º
1. Create cursor £»
2. Parse, if it is not already in the shared pool.£»
3. Any query in the statement is processed.
4. Bind Variables
5. Execute.
6. If possible, the statement is parallelized.
7. Rows to be returned are fetched. ÆäÖУ¬Parse—ÊÇ×îÓÐÓÅ»¯Ç±Á¦µÄ½×¶Î¡£
Cursor´´½¨ºó£¬oracle½«ÔÚshare poolÖÐÑ°ÕÒÊÇ·ñ¸ÃsqlÓï¾äÒѾ´æÔÚ£¬ÈôÒѾ´æÔÚÇÒÒѾ±»parsed£¬Ôò²»ÐèÒªÔÙÖ´ÐÐparse£¬Ö±½Óµ½ÏÂÒ»²½¡£ÈôδÔÚshare poolÖÐÕ
Ïà¹ØÎĵµ£º
±¾ÒëÎIJÉÓÃ֪ʶ¹²ÏíÊðÃû-·ÇÉÌÒµÐÔʹÓÃ-Ïàͬ·½Ê½¹²Ïí 3.0 UnportedÐí¿ÉÐÒé·¢²¼£¬×ªÔØÇë±£Áô´ËÐÅÏ¢
ÒëÕߣºÂí³ÝÜÈ | Á´½Ó£ºhttp://www.dbabeta.com/2010/oracle-sql-server-comparison-i.html
×÷ÕߣºSadequl Hussain | ÔÎÄ£ºhttp://www.sql-server-performance.com/articles/dba/oracle_sql_server_comparison_p1.aspx
Ò» ......
SQL×Ö·û´®º¯Êýhttp://www.cnblogs.com/virusswb/archive/2008/09/10/1288576.html
selectÓï¾äÖÐÖ»ÄÜʹÓÃsqlº¯Êý¶Ô×ֶνøÐвÙ×÷£¨Á´½Ósql server£©£¬
select ×Ö¶Î1 from ±í1 where ×Ö¶Î1.IndexOf("ÔÆ")=1;
ÕâÌõÓï¾ä²»¶ÔµÄÔÒòÊÇindexof£¨£©º¯Êý²»ÊÇsqlº¯Êý£¬¸Ä³Ésql¶ÔÓ¦µÄº¯Êý¾Í¿ÉÒÔÁË¡£
left£¨£©ÊÇsqlº¯Êý¡£
select ×Ö ......
¹¦ÄÜ£ºÐ¡Ð´½ð¶îת»»³É´óд
²ÎÊý£º@LowerMoney Сд½ð¶î ¼ÓÉÏСÊýµã×¿ÉÒÔ±£Áô38λ
Êä³ö£º´óд½ð¶î
¼ò½é£ºSQL°æ Сд½ð¶îת»»³É´óд½ð¶î£¨×î¶à¿ÉÒÔ¾«È·µ½Ð¡ÊýµãËÄ룩
×¢£º Decimal Êý¾ÝÀàÐÍ×î¶à¿É´æ´¢ 38 ¸öÊý×Ö
תÔØ£ºÇë±£ÁôÒÔÉÏÐÅÏ¢,лл£¡£¡£¡
********************************* ......
ÒÔÇ°ÔÚ2000Àï¿ÉÒÔÊý¾Ýµ¼Èëµ¼³ö£¬µ±È»ÔÚ2005ÀïÒ²²»ÀýÍ⣬ͬÑùÓÐÕâÑùµÄ²Ù×÷£¬Ö»ÊÇÔÚ²Ù×÷ÉϺÍ2000ÓеãÇø±ð£¬ÏÂÃæͨ¹ýͼÎĵķ½·¨½ÌÄãÔõÑùµ¼Èëµ¼³öÊý¾Ý¡£
²Ù×÷²½Ö裺
1¡¢Èçͼ£¬ÔÚ“¶ÔÏó×ÊÁϹÜÀíÆ÷”ÀÓÒ»÷ÄãÒªµ¼Èëµ¼³öÊý¾ÝµÄÊý¾Ý¿â£¬Ñ¡Ôñ“ÈÎÎñ”ÀïµÄµ¼ÈëÊý¾Ý»òµ¼³öÊý¾Ý£¬ÎÒÕâÀïÒÔµ¼ÈëÊý¾ÝΪÀý£¬µ¼³öÊ ......