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 ......
×î½ü×ö¶ÌÐÅȺ·¢ÏîÄ¿ÓÐÒ»¸öÐèÇó,ÐèÒª¿Í»§´óÅúÁ¿(Ê®Íò¼¶)µ¼ÈëÊý¾Ý.
¿ªÊ¼ÊÇÓÃinsertµ¥ÌõÊý¾Ý,10ÍòÌõÊý¾ÝÒª20·ÖÖÓ
ºóÀ´·¢ÏÖ¿ÉÒÔÓÃinsert all Ò»ÌõsqlÒ»´Îµ¼Èë500Ìõ¼Ç¼,ÕâÑù10ÍòÌõÊý¾ÝÖ»ÓÃÁË1.5·ÖÖÓ,µ¼ÈëËÙ¶ÈÌá¸ßÁ˽üÀ´20±¶
ÏÂÃæ¾ÍʹÓÃinsert allµÄÐĵÃÌå»á¼Ç¼ÈçÏÂ.
ʹÓ÷½·¨:
insert all into table_name(col_1,col_2) v ......
oracle²»Óð²×°¿Í»§¶ËÒ²¿ÉÒÔÓÃplsqlÔ¶³ÌÁ¬½Ó(ת£©
oracle²»Óð²×°¿Í»§¶ËÒ²¿ÉÒÔÓÃplsqlÔ¶³ÌÁ¬½Ó pl sqlÔ¶³ÌÁ¬½Ó
2008-01-14 14:33
oracle²»Óð²×°¿Í»§¶ËÒ²¿ÉÒÔÓÃplsqlÔ¶³ÌÁ¬½Ó
ÿ´ÎÎÊÈ˼ң¬plsql ¿É²»¿ÉÒÔÖ±½ÓÔ¶³ÌÁ¬½Ó·þÎñÆ÷£¬ËûÃǶ¼ËµÒª°²×°¿Í»§¶Ë£¬¼ÇµÃÒÔÇ°Ó ......
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 ......
OracleÍⲿÉí·ÝÈÏÖ¤Ñо¿
ÃÜÂëÎļþÈÏÖ¤ ²Ù×÷ϵͳÈÏÖ¤ remote_login_passwordfile SQLNET.AUTHENTICATION_SERVICES &nb ......