您的位置:首页 > 其它

RedHat搭建DHCP服务器

2014-08-20 17:20 239 查看
        当需要释放数据库空间的时候,通常的方案会用有truncate、delete、drop/re-creating等处理。其中truncate 后会立即释放,并且不能回滚;但delete不能立即释放数据库空间,还会产生archive log。下面就简单介绍一下:

 

Truncate

    如: Truncate table xxxx; 我们可以直接去查user_segments对应table的bytes就变小,数据库空间释放,并且不能回滚。用Truncate去删除记录比drop表再创建表效率更高。

 
Use the 
TRUNCATE
 statement to remove all rows from a table or cluster. By default, Oracle Database also deallocates all space used by the removed rows except that specified by the 
MINEXTENTS
 storage parameter and sets the 
NEXT
 storage parameter to the size of the last extent removed from the segment by the truncation process.
Removing rows with the 
TRUNCATE
 statement can be more efficient than dropping and re-creating a table. Dropping and re-creating a table invalidates dependent objects of the table, requires you to regrant object privileges on the table, and requires you to re-create the indexes, integrity constraints, and triggers on the table and respecify its storage parameters. Truncating has none of these effects.
 

Delete

      Delete操作后,不能立即释放数据库空间,并且还会产生archive log(查看user_segments大小没有变化),需要做其他操作。如Oracle 10g, 11可以用下面操作来释放数据库空间。

      alter table table_name shrink space cascade;

      如果报ora-10636 row movement is not enabled,先执行下面语句:

      alter table table_name enable row movement;

 

 

 

(由于是个人的一些理解,主要是总结一下,如有不对,欢迎指正)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: