Welcome 微信登录

首页 / 数据库 / MySQL / Oracle中关于清除数据释放表空间等方面的sql

    前些日子,数据库空间爆满,已经增长到存储空间单个存储文件的最大值32G。但是,采用了很多办法才释放掉表空间,主要是系统中大量使用分区表,而针对分区表清除数据,不会释放表空间,必须把分区drop掉,才会释放空间。记录一下当时操作时学习和使用的一些语句:    一、drop表    执行drop table xx 语句    drop后的表被放在回收站(user_recyclebin)里,而不是直接删除掉。这样,回收站里的表信息就可以被恢复,或彻底清除。    通过查询回收站user_recyclebin获取被删除的表信息,然后使用语句                   flashback table <user_recyclebin.object_name or user_recyclebin.original_name> to before drop [rename to <new_table_name>];                   将回收站里的表恢复为原名称或指定新名称,表中数据不会丢失。                   若要彻底删除表,则使用语句:drop table <table_name> purge;                    清除回收站里的信息                   清除指定表:purge table <table_name>;                   清除当前用户的回收站:purge recyclebin;                   清除所有用户的回收站:purge dba_recyclebin;    不放入回收站,直接删除则是:drop table xx purge;举例如下:===============================================================================SQL> select * from test1;A B C-- -- ----------11 5 11 10 2 rows selectedSQL> create table test2 as select * from test1;Table createdSQL> select * from test2;A B C-- -- ----------11 5 11 10 2 rows selectedSQL> drop table test2;Table droppedSQL> select object_name, original_name, operation, type from user_recyclebin;OBJECT_NAME ORIGINAL_NAME OPERATION TYPE
  • 1
  • 2
  • 下一页
Oracle数据库创造TPC-C性能测试世界纪录使执行的sql语句变为Linux后台进程执行相关资讯      oracle 
  • [INS-32052] Oracle基目录和Oracle  (07/22/2014 07:41:41)
  • Oracle 4个大对象(lobs)数据类型  (02/03/2013 12:33:05)
  • Oracle按时间段分组统计  (07/26/2012 10:36:48)
  • [Oracle] dbms_metadata.get_ddl的  (07/12/2013 07:37:30)
  • Liferay Portal 配置使用Oracle和  (07/31/2012 20:07:18)
  • Concurrent Request:Inactive   (07/20/2012 07:44:05)
本文评论 查看全部评论 (0)
表情: 姓名: 字数