Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Oracle truncate table Óë delete tabelµÄÇø±ð

ÍøÉϲéÔÄÁËһЩÏà¹ØµÄÌû×ÓºÍÎÄÕ£¬Ëµ·¨´óÌåÏàͬ£¬µ«ÓÐЩµØ·½»¹ÊÇÓÐЩ²»Ò»Ñù£¬ÔÚÕâÀïÉÔ΢С×ܽáһ϶þÕßµÄÇø±ð°É¡£
1.
delete²úÉúrollbackºÍÏà¹ØËøÐÅÏ¢£¬Èç¹ûɾ³ý´óÊý¾ÝÁ¿µÄ±íËٶȻáºÜÂý£¬Í¬Ê±»áÕ¼ÓúܶàµÄrollback segments .¶øtruncate ÊÇDDL²Ù×÷£¬²»²úÉúrollback£¬Ëٶȿì.
Truncate table does not generate rollback information and redo records so it is much faster than delete.
In default, it deallocates all space except the space allocated by MINEXTENTS unless you specify REUSE STORAGE clause.
2.
delete²»´ÓtablespaceÖÐÌÚ³ö¿Õ¼ä,ÐèÒª ALTER TABLESPACE AAA COALESCE; ²ÅÓпռä
3.
truncate µ÷Õûhigh water mark ¶ødelete²».truncateÖ®ºó£¬TABLEµÄHWMÍ˻ص½ INITIALºÍNEXTµÄλÖã¨Ä¬ÈÏ£©£¬delete Ôò²»¿ÉÒÔ¡£
4.
truncate Ö»ÄܶÔTABLE£¬delete ¿ÉÒÔÊÇtable,view,synonym¡£
5.
TRUNCATE TABLE µÄ¶ÔÏó±ØÐëÊDZ¾Ä£Ê½Ïµģ¬»òÕßÓÐdrop any tableµÄȨÏÞ ¶ø DELETE ÔòÊǶÔÏó±ØÐëÊDZ¾Ä£Ê½Ïµģ¬»ò±»ÊÚÓè DELETE ON SCHEMA.TABLE »òDELETE ANY TABLEµÄȨÏÞ¡£
6.
truncateÊÇDDLÓïÑÔ. deleteÊÇDMLÓïÑÔ¡£²»¹ýҪעÒâ¾ÍÊÇ truncate ²»ÄÜÔÚ pl/sql ÉÏʹÓã¬ÒªÓà dynamic SQL ²Å¿ÉÒÔ¡£
DDLÓïÑÔÊÇ×Ô¶¯Ìá½»µÄ. ÃüÁîÍê³É¾Í²»¿É»Ø¹ö.
truncateµÄËÙ¶ÈÒ²±ÈdeleteÒª¿ìµÃ¶à.
7.
truncateµÄʱºòINDEXÒ²»áɾµô£¬¶ødeleteÔò²»»á¡£


Ïà¹ØÎĵµ£º

[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(¶þ)

±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Ò»)--αÁÐROWNUMʹÓü¼ÇÉ
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(¶þ)--±êÁ¿×Ó²éѯ
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Èý)--PackageµÄÓŵã
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(ËÄ)--ÅúÁ¿´¦Àí
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Îå)--µ÷Óô洢¹ý³Ì·µ»Ø½á¹û¼¯
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Áù)- ......

[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Îå)

±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Ò»)--αÁÐROWNUMʹÓü¼ÇÉ
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(¶þ)--±êÁ¿×Ó²éѯ
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Èý)--PackageµÄÓŵã
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(ËÄ)--ÅúÁ¿´¦Àí
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Îå)--µ÷Óô洢¹ý³Ì·µ»Ø½á¹û¼¯
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Áù)- ......

MYSQLºÍORACLEµÄһЩ²Ù×÷Çø±ð

ÓкܶàÓ¦ÓÃÏîÄ¿, ¸ÕÆð²½µÄʱºòÓÃMYSQLÊý¾Ý¿â»ù±¾ÉÏÄÜʵÏÖ¸÷ÖÖ¹¦ÄÜÐèÇó£¬Ëæ×ÅÓ¦ÓÃÓû§µÄÔö¶à£¬Êý¾ÝÁ¿µÄÔö¼Ó£¬MYSQL½¥½¥µØ³öÏÖ²»¿°ÖظºµÄÇé¿ö£º
Á¬½ÓºÜÂýÉõÖÁå´»ú£¬ÓÚÊǾÍÓаÑÊý¾Ý´ÓMYSQLǨµ½ORACLEµÄÐèÇó£¬Ó¦ÓóÌÐòÒ²ÒªÏàÓ¦×öһЩÐ޸ġ£±¾ÈË×ܽá³öÒÔϼ¸µã×¢ÒâÊÂÏϣÍû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
1£® ×Ô¶¯Ôö³¤µÄÊý¾ÝÀàÐ ......

sqlserverÒÆֲΪOracle±Ê¼Ç

Oracle±Ê¼Ç
l         ¹ØÓÚTRUNCº¯Êý
   SELECT
   RELATED_ID ,
      DOC_ID ,
      CAT_ID ,
      CAT_CODE ,
      RELEASE_DATE ,
&n ......

SQLServerºÍOracle³£Óú¯Êý¶Ô±È


Êýѧº¯Êý
ÔÚoracle ÖÐdistinct¹Ø¼ü×Ö¿ÉÒÔÏÔʾÏàͬ¼Ç¼ֻÏÔʾһÌõ
¡¡¡¡1.¾ø¶ÔÖµ
¡¡¡¡S:select abs(-1) value
¡¡¡¡O:select abs(-1) value from dual
¡¡¡¡2.È¡Õû(´ó)
¡¡¡¡S:select ceiling(-1.001) value
¡¡¡¡O:select ceil(-1.001) value from dual
¡¡¡¡3.È¡Õû£¨Ð¡£©
¡¡¡¡S:select floor(-1.001) value ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ