Oracle ±íÁ¬½Ó·½Ê½·ÖÎö
Ò» ÒýÑÔ
Êý¾Ý²Ö¿â¼¼ÊõÊÇÄ¿Ç°ÒÑÖªµÄ±È½Ï³ÉÊìºÍ±»¹ã·º²ÉÓõĽâ¾ö·½°¸£¬ÓÃÓÚÕûºÍµçÐÅÔËÓªÆóÒµÄÚ²¿ËùÓзÖÉ¢µÄÔʼҵÎñÊý¾Ý£¬²¢Í¨¹ý±ã½ÝÓÐЧµÄÊý¾Ý·ÃÎÊÊֶΣ¬¿ÉÒÔÖ§³ÖÆóÒµÄÚ²¿²»Í¬²¿ÃÅ£¬²»Í¬ÐèÇ󣬲»Í¬²ã´ÎµÄÓû§Ëæʱ»ñµÃ×Ô¼ºËùÐèµÄÐÅÏ¢¡£Êý¾Ý²Ö¿âϵͳÐèÒªÄܹ»¼°Ê±µØ×·×ٺͷÖÎö´óÁ¿µÄÀúÊ·Êý¾Ý£¬²¢Äܹ»¼°Ê±×ö³ö·ÖÎöºÍÔ¤²â£¬Òò´ËʵʱÐÔÊÇÒ»¸ö·Ç³£ÖØÒªµÄÖ¸±ê¡£ORACLEÓÉÓÚ¿É¿¿ÐÔ¡¢¸ßÐÔÄܵȷ½ÃæµÄÌص㣬ÔÚµçÐÅÐÐÒµ´ó²¿·ÖµÄÊý¾Ý²Ö¿âϵͳÖе£µ±Á˺ǫ́Êý¾Ý¿âµÄ½ÇÉ«¡£ÓÉÓÚµçÐÅÐÐÒµµÄÌص㣬´¦ÀíµÄÊý¾ÝÁ¿Ê®·ÖÅӴ󣬴¦ÀíµÄʱ¼ä³¤¡£ÓÈÆäÊǶÔÓÚ´ó±íÖ®¼äµÄ¹ØÁª²Ù×÷£¬ÓеĴó±íµÄ¼Ç¼Êý´ïµ½ÊýÒÚÌõ£¬´¦Àíʱ¼ä¸üÊÇÂþ³¤£¬Õâ³ÉΪӰÏìÊý¾Ý¿âÔËÐÐЧÂʵÄÖ÷ÒªÒòËØ¡£Òò´Ë£¬¶ÔÓÚÊý¾Ý¿âµÄÐÔÄÜÓÅ»¯Ï൱ÖØÒª¡£ÐÔÄÜÓÅ»¯ÊǸöºÜ´óµÄ¿ÎÌ⣬ÐèÒª×ۺϿ¼ÂÇ£¬´Ó·þÎñÆ÷¡¢´ÅÅÌ¡¢ÍøÂç¡¢ORACLEʵÀý¡¢ORACLE SQLµÈ¶à·½Ãæ×ÅÊÖ¡£±¾ÎÄ×ÅÖØ·ÖÎöORACLE SQLÓÅ»¯ÖжÔÓÚϵͳÐÔÄÜÓ°Ï켫´óµÄ±íÁ¬½Ó·½Ê½¡¢Ìص㡢ÊÊÓ÷¶Î§£¬²¢¶ÔÈçºÎʹÓúÍÓÅ»¯×öÁËÏêϸµÄ̽ÌÖ¡£
¶þ ±íµÄÁ¬½Ó
±íµÄÁ¬½ÓÊÇÖ¸ÔÚÒ»¸öSQLÓï¾äÖÐͨ¹ý±íÓë±íÖ®¼äµÄ¹ØÁª£¬´ÓÒ»¸ö»ò¶à¸ö±í¼ìË÷³öÏà¹ØµÄÊý¾Ý¡£Á¬½ÓÊÇͨ¹ýSQLÓï¾äÖÐfrom´Ó¾äµÄ¶à¸ö±íÃû£¬ÒÔ¼°WHERE´Ó¾äÀﶨÒåµÄ±íÖ®¼äµÄÁ¬½ÓÌõ¼þÀ´ÊµÏֵġ£Èç¹ûÒ»¸öSQLÓï¾äµÄ¹ØÁª±í³¬¹ýÁ½¸ö£¬ÄÇôÁ¬½ÓµÄ˳ÐòÈçºÎÄØ£¿ORACLEÊ×ÏÈÁ¬½ÓÆäÖеÄÁ½¸ö±í£¬²úÉúÒ»¸ö½á¹û¼¯£»È»ºó½«²úÉúµÄ½á¹û¼¯ÓëÏÂÒ»¸ö±íÔÙ½øÐйØÁª£»¼ÌÐøÕâ¸ö¹ý³Ì£¬Ö±µ½ËùÓÐµÄ±í¶¼Á¬½ÓÍê³É£»×îºó²úÉúËùÐèµÄÊý¾Ý¡£ÏÂÃ涼ÒÔÁ½¸ö±íµÄÁ¬½ÓΪÀý
create table user_info(user_name char(10),user_id char(10));
create table dev_info(dev_no char(10),user_id char(10),dev_type char(10));
˵Ã÷ºÍ·ÖÎö±íµÄ¸÷ÖÖÁ¬½Ó·½Ê½¡£
ORACLE ´Ó6µÄ°æ±¾¿ªÊ¼£¬ÓÅ»¯Æ÷ʹÓÃ4ÖÖ²»Í¬µÄ±íµÄÁ¬½Ó·½Ê½£º
Ø Ç¶Ì×Ñ»·Á¬½Ó£¨NESTED LOOP JOIN£©
Ø Èº¼¯Á¬½Ó (CLUSTER JOIN)
Ø ÅÅÐòºÏ²¢Á¬½Ó£¨SORT MERGE JOIN£©
Ø µÑ¿¨¶ûÁ¬½Ó (CARTESIAN JOIN)
ORACLE 7.3ÖУ¬ÐÂÔö¼ÓÁË
Ø ¹þÏ£Á¬½Ó(HASH JOIN)¡£
ÔÚORACLE 8ÖУ¬ÐÂÔö¼ÓÁË
Ø Ë÷ÒýÁ¬½Ó(INDEX JOIN)¡£
ÕâÁùÖÖÁ¬½Ó·½Ê½¶¼ÓÐÆä¶ÀÌصļ¼ÊõÌص㣬ÔÚÒ»¶¨µÄÌõ¼þÏ£¬¿ÉÒÔ³ä·Ö·¢»Ó¸ßЧµÄÐÔÄÜ¡£
µ«ÊÇÒ²¶¼ÓÐÆä¾ÖÏÞÐÔ£¬Èç¹ûʹÓò»µ±£¬²»½ö²»ÄÜÌá¸ßЧÂÊ£¬·´¶ø»áÑÏÖØÓ°ÏìϵͳµÄÐÔÄÜ¡£Òò´Ë£¬ÉîÈëµØ̽ÌÖÁ¬½Ó·½Ê½µÄÄÚ²¿ÔËÐлúÖƶÔÓÚÐÔÄÜÓÅ»¯ÊDZØÒªµÄ¡£
1 ǶÌ×Ñ»·Á¬½Ó
ǶÌ×Ñ»·Á¬½ÓµÄÄÚ²¿´¦ÀíµÄÁ÷³Ì£º
Ïà¹ØÎĵµ£º
Union£¬¶ÔÁ½¸ö½á¹û¼¯½øÐв¢¼¯²Ù×÷£¬²»°üÀ¨Öظ´ÐУ¬Í¬Ê±½øÐÐĬÈϹæÔòµÄÅÅÐò£»
Union All£¬¶ÔÁ½¸ö½á¹û¼¯½øÐв¢¼¯²Ù×÷£¬°üÀ¨Öظ´ÐУ¬²»½øÐÐÅÅÐò£»
Intersect£¬¶ÔÁ½¸ö½á¹û¼¯½øÐн»¼¯²Ù×÷£¬²»°üÀ¨Öظ´ÐУ¬Í¬Ê±½øÐÐĬÈϹæÔòµÄÅÅÐò£»
Minus£¬¶ÔÁ½¸ö½á¹û¼¯½øÐвî²Ù×÷£¬²»°üÀ¨Öظ´ÐУ¬Í¬Ê±½øÐÐĬÈϹæÔòµÄÅÅÐò¡£
¿ÉÒÔÔÚ×î ......
1¡¢ÓÃdblinkÁ´½Óoracle
£¨1£©Óëƽ̨Î޹صÄд·¨£º
create public database
link cdt connect to apps
identified by apps using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.31.205.100)(PORT = 1541))
)
(CONNECT_DATA =
(SERVICE_NAME = CDT)
)
)'
£¨2£©¿ÉÒÔ½«µ¥ÒýºÅÄÚµÄÄÚÈÝ ......
OracleÖÐUSERENVºÍSYS_CONTEXTÓÃÀ´·µ»Øµ±Ç°sessionµÄÐÅÏ¢£¬ÆäÖУ¬userenvÊÇΪÁ˱£³ÖÏòϼæÈݵÄÒÅÁôº¯Êý£¬ÍƼöʹÓÃsys_contextº¯Êýµ÷ÓÃuserenvÃüÃû¿Õ¼äÀ´»ñÈ¡Ïà¹ØÐÅÏ¢¡£
1¡¢ USERENV(OPTION)
¡¡¡¡·µ»Øµ±Ç°µÄ»á»°ÐÅÏ¢.
¡¡¡¡OPTION='ISDBA'Èôµ±Ç°ÊÇDBA½ÇÉ«,ÔòΪTRUE,·ñÔòFALSE.
¡¡¡¡OPTION='LANGUAGE'·µ»ØÊý¾Ý¿âµÄ ......
´Ó10g¿ªÊ¼£¬oracle¿ªÊ¼ÌṩShrinkµÄÃüÁ¼ÙÈçÎÒÃǵıí¿Õ¼äÖÐÖ§³Ö×Ô¶¯¶Î¿Õ¼ä¹ÜÀí (ASSM),¾Í¿ÉÒÔʹÓÃÕâ¸öÌØÐÔËõС¶Î£¬¼´½µµÍHWM¡£ÕâÀïÐèҪǿµ÷Ò»µã£¬10gµÄÕâ¸öÐÂÌØÐÔ£¬½ö¶ÔASSM±í¿Õ¼äÓÐЧ£¬·ñÔò»á±¨ ORA-10635: Invalid segment or tablespace type¡£
Èç¹û¾³£ÔÚ±íÉÏÖ´ÐÐDML²Ù× ......