oracleÖÐtruncate,delete,dropµÄÒìͬµã
truncate,delete,dropµÄÒìͬµã
×¢Òâ:ÕâÀï˵µÄdeleteÊÇÖ¸²»´øwhere×Ó¾äµÄdeleteÓï¾ä
Ïàͬµã:truncateºÍ²»´øwhere×Ó¾äµÄdelete, ÒÔ¼°drop¶¼»áɾ³ý±íÄÚµÄÊý¾Ý
²»Í¬µã:
1. truncateºÍ deleteֻɾ³ýÊý¾Ý²»É¾³ý±íµÄ½á¹¹(¶¨Òå)
dropÓï¾ä½«É¾³ý±íµÄ½á¹¹±»ÒÀÀµµÄÔ¼Êø(constrain),´¥·¢Æ÷(trigger),Ë÷Òý(index); ÒÀÀµÓڸñíµÄ´æ´¢¹ý³Ì/º¯Êý½«±£Áô,µ«ÊDZäΪinvalid״̬.
2.deleteÓï¾äÊÇdml,Õâ¸ö²Ù×÷»á·Åµ½rollback segementÖÐ,ÊÂÎñÌá½»Ö®ºó²ÅÉúЧ;Èç¹ûÓÐÏàÓ¦µÄtrigger,Ö´ÐеÄʱºò½«±»´¥·¢.
truncate,dropÊÇddl, ²Ù×÷Á¢¼´ÉúЧ,ÔÊý¾Ý²»·Åµ½rollback segmentÖÐ,²»Äܻعö. ²Ù×÷²»´¥·¢trigger.
3.deleteÓï¾ä²»Ó°Ïì±íËùÕ¼ÓõÄextent, ¸ßË®Ïß(high watermark)±£³ÖÔλÖò»¶¯
ÏÔÈ»dropÓï¾ä½«±íËùÕ¼ÓõĿռäÈ«²¿ÊÍ·Å
truncate Óï¾äȱʡÇé¿öϽ«¿Õ¼äÊͷŵ½ minextents¸ö extent,³ý·ÇʹÓÃreuse storage; truncate»á½«¸ßË®Ï߸´Î»(»Øµ½×ʼ).
4.ËÙ¶È,Ò»°ãÀ´Ëµ: drop> truncate > delete
5.°²È«ÐÔ:СÐÄʹÓÃdrop ºÍtruncate,ÓÈÆäûÓб¸·ÝµÄʱºò.·ñÔò¿Þ¶¼À´²»¼°
ʹÓÃÉÏ,Ïëɾ³ý²¿·ÖÊý¾ÝÐÐÓÃdelete,×¢Òâ´øÉÏwhere×Ó¾ä. »Ø¹ö¶ÎÒª×ã¹»´ó.
Ïëɾ³ý±í,µ±È»ÓÃdrop
Ïë±£Áô±í¶ø½«ËùÓÐÊý¾Ýɾ³ý. Èç¹ûºÍÊÂÎñÎÞ¹Ø,ÓÃtruncate¼´¿É. Èç¹ûºÍÊÂÎñÓйØ,»òÕßÏë´¥·¢trigger,»¹ÊÇÓÃdelete.
Èç¹ûÊÇÕûÀí±íÄÚ²¿µÄËéƬ,¿ÉÒÔÓÃtruncate¸úÉÏreuse stroage,ÔÙÖØе¼Èë/²åÈëÊý¾Ý
Ïà¹ØÎĵµ£º
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;
mso-font-charset:2;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 ......
×î½ü·¢ÏÖÒ»¸ö±È½ÏÓÐÒâ˼µÄÎÊÌ⣺
µ±ÎÒÃÇÔÚÖ´ÐÐÒ»Ìõ²éѯÓï¾äʱ£¬Èç¹ûÌõ¼þν´ÊÖк¬Óк¯Êý£¬Èç abs(age)<10£¬´Ëʱ£¬Í¨¹ý²éѯ¼Æ»®¿´µ½µÄ½á¹û¼¯µÄ»ùÊýÖµÓëʵ¼ÊµÄÖµÏà²îºÜ´ó¡£µ±ÎÒÃǸıä²éѯÌõ¼þʱ£¬Èçabs(age)<20£¬ÕâʱµÄ»ùÊýÖµ²»»á¸Ä±ä£¬ºÍabs(age)<10µÃµ½µÄ»ùÊýÖµÒ»Ñù¡£
µ«ÏÖÔÚ»¹Ã»ÕÒµ½ÎÊÌâµÄÔÒò£¬searching... ......
ÒÔÏÂÊÇÕª×ÔOracle¹ÙÍø:
¢ñ Oracle SQL Developer ÊÇÒ»¸öÃâ·ÑµÄͼÐλ¯Êý¾Ý¿â¿ª·¢¹¤¾ß¡£Ê¹Óà SQL Developer£¬Äú¿ÉÒÔä¯ÀÀÊý¾Ý¿â¶ÔÏó¡¢ÔËÐÐ SQL Óï¾äºÍ SQL ½Å±¾£¬²¢ÇÒ»¹¿ÉÒԱ༺͵÷ÊÔ PL/SQL Óï¾ä¡£Äú»¹¿ÉÒÔÔËÐÐËùÌṩµÄÈκÎÊýÁ¿µÄ±¨±í£¬ÒÔ¼°´´½¨ºÍ±£´æÄú×Ô¼ºµÄ±¨±í¡£SQL Developer ¿ÉÒÔÌá¸ß¹¤×÷ЧÂʲ¢¼ò»¯Êý¾Ý¿â¿ª·¢ÈÎÎñ¡£ ......
ÔÚ¹úÄÚÍâÐí¶àOracle DBAÕ¾µãÉÏ£¬Óкܶà²éÕÒ±íÖеÚn¸ö×î´óÖµµÄС¼¼ÇÉ£¬ÕâЩÓï¾äȷʵÏ൱ÇÉÃËüÃǶ¼¶À±Ùõ辶µØÓõ½ÁËOracle±íÖеÄÒ»¸öα×ֶΓlevel”¡£µ«ÊÇÔںܶàÇé¿öÏ£¬Õâ¸öÓï¾ä±ä³ÉÁË ÃÀÀöµÄÏÝÚå¡£Èç¹ûÄãÏëÖªµÀΪʲô£¬²¢ÔõÑùÈƹýËü£¬ÇëÌýÎÒµÀÀ´£¡
Ñо¿Á˼¸Ì죬ÎÒ·¢ÏÖÒ»ÖÖÑÜÉúËã·¨£¬¼´ÕÒ³öµÚn¸öºÍµÚm¸ö×î´óÖ ......
oracleÆô¶¯ÎÊÌâ
Ò»£ºÊý¾Ý¿âûÓÐÆô¶¯
#sqlplus /nolog
sql>connect /as sysdba
sql>startup
¶þ£º¼àÌý³öÎÊÌâ
µÇ¼DB·þÎñÆ÷
ʹÓÃlsnrctl start/stop¿ªÆô/¹Ø±Õ¼àÌý
ʹÓÃlsnrctl status²é¿´×´Ì¬
ÀíӦΪ£º
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ERPAP)(PORT=1521)))
STATUS of the ......