ITPub博客

首页 > Linux操作系统 > Linux操作系统 > zt_orafaq_delete与truncate的区别

zt_orafaq_delete与truncate的区别

原创 Linux操作系统 作者:wisdomone1 时间:2012-12-27 09:39:53 0 删除 编辑

Diff B/W Truncate & Delete

Delete
1.DML data can be recovered by rollback before commit
2.Remove any subset of data
3.Delete is slower when table have numerous indexes and triggers
4.DML triggers fire for delete mthod
5.data can be recovered after commit by flashback method
6.high water mark will remain the same

 -------注意7,8
7.data deleted info capture with returning clause
8. you can not delete data if function based index is invalid
9. can not delete data from complex views.
10. Space is not freed

Truncate
1.Truncated Data can not be recoverd but truncated data is also logged
2.truncate all or partition or subpartition data.

   --注意3,5,6,7
3. truncate is faster as no logs we have to maintain ,no trigger firing
4. reset the high water mark , space is released except reuse method
5. can not truncate table indivisually if it is part of cluster
6. can not truncate table with referential integerity constraint enable
7. if table is not empty unuseable indexes become useable

More details at my blog :

http://arunkaushikoracle.blogspot.in/2012/10/diff-bw-delete-truncate-in-oracle-db-on.html

8. if domain index on table is invalid or in_progess state then we can not truncate the table
8.we can not truncate a simple view , we can truncate MV but not simple view.

For More Details on all this point with examples see my blog.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-751701/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb 工作经历: 中国普天 北京科蓝 北京云和恩墨 北京神州新桥

注册时间:2008-04-04

  • 博文量
    2189
  • 访问量
    12690134