²é¿´oracleÖ´Ðмƻ®
ÈÕ³£¿ª·¢»î¶¯ÖУ¬ÓÐʱºòÐèÒª¶ÔoracleÖ´Ðмƻ®½øÐмà¿Ø£¬ÒÔ´ËÀ´µ÷ÓųÌÐòºÍÊý¾Ý¿â·½ÃæµÄÐÔÄÜ¡£
³£Ó÷½·¨ÓÐÒÔϼ¸ÖÖ£º
Ò»¡¢Í¨¹ýPL/SQL Dev¹¤¾ß
1¡¢Ö±½ÓFile->New->Explain Plan Window£¬ÔÚ´°¿ÚÖÐÖ´ÐÐsql¿ÉÒԲ鿴¼Æ»®½á¹û¡£ÆäÖУ¬Cost±íʾcpuµÄÏûºÄ£¬µ¥Î»Îªn%£¬Cardinality±íʾִÐеÄÐÐÊý£¬µÈ¼ÛRows¡£
2¡¢ÏÈÖ´ÐÐ EXPLAIN PLAN FOR select * from tableA where paraA=1£¬ÔÙ select * from table(DBMS_XPLAN.DISPLAY)±ã¿ÉÒÔ¿´µ½oracleµÄÖ´Ðмƻ®ÁË£¬¿´µ½µÄ½á¹ûºÍ1ÖеÄÒ»Ñù£¬ËùÒÔʹÓù¤¾ßµÄʱºòÍƼöʹÓÃ1·½·¨¡£
Cost ÏûºÄԽС ЧÂÊÔ½¸ß.
×¢Ò⣺PL/SQL Dev¹¤¾ßµÄCommand windowÖв»Ö§³Öset autotrance onµÄÃüÁî¡£»¹ÓÐʹÓù¤¾ß·½·¨²é¿´¼Æ»®¿´µ½µÄÐÅÏ¢²»È«£¬ÓÐЩʱºòÎÒÃÇÐèÒªsqlplusµÄÖ§³Ö¡£
¶þ¡¢Í¨¹ýsqlplus
1¡¢Ò»°ãÇé¿ö¶¼ÊDZ¾»úÁ´½ÓÔ¶³Ì·þÎñÆ÷£¬ËùÒÔÃüÁîÈçÏ£º
sqlplus user/pwd@serviceName
´Ë´¦µÄserviceNameΪtnsnames.oraÖж¨ÒåµÄÃüÃû¿Õ¼ä¡£
2¡¢Ö´ÐÐset autotrace on£¬È»ºóÖ´ÐÐsqlÓï¾ä£¬»áÁгöÒÔÏÂÐÅÏ¢£º
¡£¡£¡££¨Ê¡ÂÔһЩÐÅÏ¢£©
ͳ¼ÆÐÅÏ¢
----------------------------------------------------------
1 recursive calls £¨¹éµ÷ÓôÎÊý£©
0 db block gets
2 consistent gets
0 physical reads £¨ÎïÀí¶Á——Ö´ÐÐSQLµÄ¹ý³ÌÖУ¬´ÓÓ²ÅÌÉ϶ÁÈ¡µÄÊý¾Ý¿é¸öÊý£©
0 redo size (ÖØ×öÊý——Ö´ÐÐSQLµÄ¹ý³ÌÖУ¬²úÉúµÄÖØ×öÈÕÖ¾µÄ´óС)
358 bytes sent via SQL*Net to client
366 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
&nb
Ïà¹ØÎĵµ£º
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
cn.Open "Provider=OraOLEDB.Oracle.1;Persist Security Info= ......
´¥·¢Æ÷
q ´¥·¢Æ÷Êǵ±Ìض¨Ê¼þ³öÏÖʱ×Ô¶¯Ö´ÐеĴ洢¹ý³Ì
q Ìض¨Ê¼þ¿ÉÒÔÊÇÖ´ÐиüеÄDMLÓï¾äºÍDDLÓï¾ä
q ´¥·¢Æ÷²»Äܱ»ÏÔʽµ÷ÓÃ
q ´¥·¢Æ÷µÄ¹¦ÄÜ£º
q ......
alter system kill session'50,492';
--ÒÔϼ¸¸öΪÏà¹Ø±í
SELECT * from v$lock;
SELECT * from v$sqlarea;
SELECT * from v$session;
SELECT * from v$process ;
SELECT * from v$locked_object;
SELECT * from all_objects;
SELECT * from v$session_wait; ......
SQLµÄÓÅ»¯Ó¦¸Ã´Ó5¸ö·½Ãæ½øÐе÷Õû£º
1.È¥µô²»±ØÒªµÄ´óÐͱíµÄÈ«±íɨÃè
2.»º´æСÐͱíµÄÈ«±íɨÃè
3.¼ìÑéÓÅ»¯Ë÷ÒýµÄʹÓÃ
4.¼ìÑéÓÅ»¯µÄÁ¬½Ó¼¼Êõ
5.¾¡¿ÉÄܼõÉÙÖ´Ðмƻ®µÄCost
SQLÓï¾ä£º
ÊǶÔÊý¾Ý¿â(Êý¾Ý)½øÐвÙ×÷µÄΩһ;¾¶£»
ÏûºÄÁË70%~90%µÄÊý¾Ý¿â×ÊÔ´£»¶ÀÁ¢ÓÚ³ÌÐòÉè¼ÆÂß¼£¬Ïà¶ÔÓÚ¶Ô³ÌÐòÔ´´úÂëµÄÓÅ»¯£¬¶ÔSQLÓï¾äµÄÓÅ»¯Ô ......
·½·¨Ò»£º
1) ²é¿´·þÎñÆ÷¶Ë×Ö·û¼¯£º &nbs ......