oracleÊý¾Ý¿âµÄÓαêʹÓÃ
ÔÚ´ó¶àÊýʱºòÎÒÃÇÔÚÉè¼Æ³ÌÐòµÄʱºò¶¼×ñÑÏÂÃæµÄ²½Ö裺
1¡¢´ò¿ªÓαê
2¡¢¿ªÊ¼Ñ»·
3¡¢´ÓÓαêÖÐÈ¡Öµ
ÄÇÒ»Ðб»·µ»Ø
5¡¢´¦Àí
6¡¢¹Ø±ÕÑ»·
7¡¢¹Ø±ÕÓαê
¿ÉÒÔ¼òµ¥µÄ°ÑÕâÒ»Àà´úÂë³ÆΪÓαêÓÃÓÚÑ»·¡£µ«»¹ÓÐÒ»ÖÖÑ»·ÓëÕâÖÖÀàÐͲ»Ïàͬ£¬Õâ¾ÍÊÇFORÑ»·£¬ÓÃÓÚFORÑ»·µÄÓα갴ÕÕÕý³£µÄÉùÃ÷·½Ê½ÉùÃ÷£¬ËüµÄÓŵãÔÚÓÚ²»ÐèÒªÏÔʽµÄ´ò¿ª¡¢¹Ø±Õ¡¢È¡Êý¾Ý£¬²âÊÔÊý¾ÝµÄ´æÔÚ¡¢¶¨Òå´æ·ÅÊý¾ÝµÄ±äÁ¿µÈµÈ¡£ÓαêFORÑ»·µÄÓï·¨ÈçÏ£º
FOR record_name IN
(corsor_name[(parameter[,parameter]...)]
| (query_difinition)
LOOP
statements
END LOOP;
Ïà¹ØÎĵµ£º
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
SQL> SQLPLUS / AS SYSDBA
SQL> exec dbms_workload_repository.create_snapshot
SQL> exec:snap_id:=dbms_workload_repository.create_snapshot
SQL> var snap_id number
SQL> print snap_id
SQL> @?/rdbms/admin/awrrpt.sql
OracleAWRËÙ²é
1.²é¿´µ±Ç°µÄAWR±£´æ²ßÂÔ
select * fro ......
Óï·¨£º
select *
from ±íÃû
where Ìõ¼þ1
start with Ìõ¼þ2
connect by prior µ±Ç°±í×Ö¶Î=¼¶Áª±í×Ö¶Î
start withÓëconnect by priorÓï¾äÍê³ÉµÝ¹é¼Ç¼£¬ÐγÉÒ»¿ÃÊ÷Ðνṹ£¬Í¨³£¿ÉÒÔÔÚ¾ßÓвã´Î½á¹¹µÄ±íÖÐʹÓá£
start with±íʾ¿ªÊ¼µÄ¼Ç¼
connect by prior Ö¸¶¨Ó뵱ǰ¼Ç¼¹ØÁªÊ±µÄ×ֶιØϵ
´úÂ룺
--´´½¨²¿Ãű ......
in ÊÇ°ÑÍâ±íºÍÄÚ±í×÷hash Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ»·£¬Ã¿´ÎloopÑ»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö±ÒÔÀ´ÈÏΪexists±ÈinЧÂʸߵÄ˵·¨ÊDz»×¼È·µÄ¡£
Èç¹û²éѯµÄÁ½¸ö±í´óСÏ൱£¬ÄÇôÓÃinºÍexists²î±ð²»´ó¡£
in ÊÇ°ÑÍâ±íºÍÄÚ±í×÷hash
Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ»·£¬Ã¿´ÎloopÑ»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö±ÒÔ ......