Oracle select in/exists/not in/not exits
in ÊÇ°ÑÍâ±íºÍÄÚ±í×÷hash Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ»·£¬Ã¿´ÎloopÑ»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö±ÒÔÀ´ÈÏΪexists±ÈinЧÂʸߵÄ˵·¨ÊDz»×¼È·µÄ¡£
Èç¹û²éѯµÄÁ½¸ö±í´óСÏ൱£¬ÄÇôÓÃinºÍexists²î±ð²»´ó¡£
in ÊÇ°ÑÍâ±íºÍÄÚ±í×÷hash
Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ»·£¬Ã¿´ÎloopÑ»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö±ÒÔÀ´ÈÏΪexists±ÈinЧÂʸߵÄ˵·¨ÊDz»×¼È·µÄ¡£
Èç¹û²éѯµÄÁ½¸ö±í´óСÏ൱£¬ÄÇôÓÃinºÍexists²î±ð²»´ó¡£
Èç¹ûÁ½¸ö±íÖÐÒ»¸ö½ÏС£¬Ò»¸öÊÇ´ó±í£¬Ôò×Ó²éѯ±í´óµÄÓÃexists£¬×Ó²éѯ±íСµÄÓÃin£º
ÀýÈ磺±íA£¨Ð¡±í£©£¬±íB£¨´ó±í£©
1£º
select * from A where cc in (select cc from B)
ЧÂʵͣ¬Óõ½ÁËA±íÉÏccÁеÄË÷Òý£»
select * from A where exists(select cc from B where
cc=A.cc)
ЧÂʸߣ¬Óõ½ÁËB±íÉÏccÁеÄË÷Òý¡£
Ïà·´µÄ
2£º
select * from B where cc in (select cc from A)
ЧÂʸߣ¬Óõ½ÁËB±íÉÏccÁеÄË÷Òý£»
select * from B where exists(select cc from A where
cc=B.cc)
ЧÂʵͣ¬Óõ½ÁËA±íÉÏccÁеÄË÷Òý¡£
not in ºÍnot exists
Èç¹û²éѯÓï¾äʹÓÃÁËnot in ÄÇôÄÚÍâ±í¶¼½øÐÐÈ«±íɨÃ裬ûÓÐÓõ½Ë÷Òý£»
¶ønot extsts µÄ×Ó²éѯÒÀÈ»ÄÜÓõ½±íÉϵÄË÷Òý¡£
ËùÒÔÎÞÂÛÄǸö±í´ó£¬ÓÃnot exists¶¼±Ènot inÒª¿ì¡£
in Óë =µÄÇø±ð
select name from student where name in
('zhang','wang','li','zhao');
Óë
select name from student where name='zhang' or
name='li' or name='wang' or name='zhao'
µÄ½á¹ûÊÇÏàͬµÄ¡£
http://blog.163.com/sz_putishu/blog/static/121826854200963131426178/
Ïà¹ØÎĵµ£º
OracleÊý¾Ýµ¼Èëµ¼³öimp/expÃüÁî
Oracle Êý¾Ýµ¼Èëµ¼³öimp/exp¾ÍÏ൱ÓÚoracleÊý¾Ý»¹ÔÓ뱸·Ý¡£expÃüÁî¿ÉÒÔ°ÑÊý¾Ý´ÓÔ¶³ÌÊý¾Ý¿â·þÎñÆ÷µ¼³öµ½±¾µØµÄdmpÎļþ£¬impÃüÁî¿ÉÒÔ°Ñ dmpÎļþ´Ó±¾µØµ¼Èëµ½Ô¶´¦µÄÊý¾Ý¿â·þÎñÆ÷ÖС£ ÀûÓÃÕâ¸ö¹¦ÄÜ¿ÉÒÔ¹¹½¨Á½¸öÏàͬµÄÊý¾Ý¿â£¬Ò»¸öÓÃÀ´²âÊÔ£¬Ò»¸öÓÃÀ´ÕýʽʹÓá£
Ö´Ðл ......
¾Û¼¯(cluster)ÊÇ´æ´¢±íÊý¾ÝµÄ¿ÉÑ¡ÔñµÄ·½·¨¡£Ò»¸ö¾Û¼¯ÊÇÒ»×é±í£¬½«¾ßÓÐͬһ¹«¹²ÁÐÖµµÄÐд洢ÔÚÒ»Æ𣬲¢ÇÒËüÃǾ³£Ò»ÆðʹÓá£ÕâЩ¹«¹²Áй¹³É¾Û¼¯Âë¡£
¾³£±»Í¬Ê±·ÃÎʵıíÔÚÎïÀíλÖÃÉÏ¿ÉÒÔ´æ´¢ÔÚÒ»Æð¡£ÎªÁ˽«ËüÃÇ´æ´¢ÔÚÒ»Æ𣬾ÍÒª´´½¨Ò»¸ö´Ø( c l u s t e r )À´¹ÜÀíÕâЩ±í¡£±íÖеÄÊý¾ÝÒ»Æð´æ´¢ÔÚ´ØÖУ¬´Ó¶ø×îС»¯±ØÐëÖ´ÐеÄI ......
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 ......
½ñÌìÔÚ¶Ô±í´´½¨ÊÓͼµÄʱºò£¬Óû§Ìáʾ ORA-01031Óû§È¨ÏÞ²»×ã
ʹÓÃsystemÓû§¶ÔÆä·ÖÅädbaµÈȨÏÞ£¬ÒÀÈ»ÎÞ·¨´´½¨ÊÓͼ¡£
¼ÌÐø¸³ÓèȨÏÞ
grant select any table to AAA;
ÊÚÓèÓû§Ñ¯ËùÓбíµÄȨÏÞ
grant select any dictionary to AAA;
ÔÙ´ÎÊÚÈ¡Óû§selectÈκÎ×ÖµäµÄȨÏÞ
......
ÒòΪÏîĿijЩģ¿éµÄÊý¾Ý½á¹¹Éè¼ÆûÓÐÑϸñ°´ÕÕij¹æ·¶Éè¼Æ£¬ËùÒÔÖ»ÄÜ´ÓÊý¾Ý¿âÖвéѯÊý¾Ý½á¹¹£¬ÐèÒª²éѯµÄÐÅÏ¢ÈçÏ£º×Ö¶ÎÃû³Æ¡¢Êý¾ÝÀàÐÍ¡¢ÊÇ·ñΪ¿Õ¡¢Ä¬ÈÏÖµ¡¢Ö÷¼ü¡¢Íâ¼üµÈµÈ¡£
ÔÚÍøÉÏËÑË÷Á˲éѯÉÏÊöÐÅÏ¢µÄ·½·¨£¬×ܽáÈçÏ£º
Ò»£¬²éѯ±í»ù±¾ÐÅÏ¢
select
utc.column_name,utc.data_type,utc.data_le ......