oracle 在删除表,表空间,用户时 如何释放磁盘空间
oracle删除表,释放表空间,需要通过truncate table xx,然后drop table xxx 来释放,或者直接通过 drop table xxx purge;
示例如下:
1、创建测试表,
create table test_space(id number, name varchar2(20));
2、插入样例数据,
insert into test_space
select level, 'test_space_'||level
from dual
connect by level<100000
3、查看该表存储,占用3145728B大小,
select * from user_segments t where segment_name = upper('test_space');
4、truncate清空表数据,truncate table test_space,然后再次查询表存储,存储变为65536B,已释放;
truncate table test_space;
select * from user_segments t
where segment_name = upper('test_space');
5、把表再次删除后,存储已释放;
drop table test_space;
select bytes from user_segments t
where segment_name = upper('test_space');