然后我们在这个表空间上创建一个测试表a
SQL> create table w1.a tablespace test1 as select * from dba_objects;Table created.SQL> select owner,segment_name,round(bytes/1024/1024,2)||' MB' m from dba_segments where tablespace_name='TEST1';OWNER SEGMENT_NAME M------------ ---------------------------------------------------------------------------------------W1 A 6 MBSQL>
一张表占用6M空间,我们再创建2张一样的测试表
SQL> create table w1.b tablespace test1 as select * from dba_objects;Table created.SQL> create table w1.c tablespace test1 as select * from dba_objects;Table created.SQL> select round(sum(bytes)/1024/1024,2)||' MB' from dba_segments where tablespace_name='TEST1';ROUND(SUM(BYTES)/1024/1024,2)||'MB'-------------------------------------------18 MB
此时表空间已经使用了18M。这时我们把这三张表都删除
SQL> drop table w1.a;Table dropped.SQL> drop table w1.b;Table dropped.SQL> drop table w1.c;Table dropped.SQL> select owner,object_name,original_name from dba_recyclebin where ts_name='TEST1';OWNER OBJECT_NAME------------------------------ ------------------------------ORIGINAL_NAME--------------------------------W1 BIN$r6HZooW/xpzgQKjAb01Spw==$0BW1 BIN$r6HZooW+xpzgQKjAb01Spw==$0AW1 BIN$r6HZooXAxpzgQKjAb01Spw==$0CSQL> col owner format a4SQL> col segment_name format a35SQL> col m format a10SQL> select owner,segment_name,round(bytes/1024/1024,2)||' MB' m from dba_segments where tablespace_name='TEST1';OWNE SEGMENT_NAME M---- ----------------------------------- ----------W1 BIN$r6HZooXAxpzgQKjAb01Spw==$0 6 MBW1 BIN$r6HZooW+xpzgQKjAb01Spw==$0 6 MBW1 BIN$r6HZooW/xpzgQKjAb01Spw==$0 6 MBSQL>
可以看到,3张表到了回收站中,空间也没有释放。
此时20m的表空间还剩余2m可用,如果我再创建一张同样的表呢
SQL> alter session set tracefile_identifier='rctest';Session altered.SQL> alter session set sql_trace=true;Session altered.SQL> create table w1.d tablespace test1 as select * from dba_objects;Table created.SQL> alter session set sql_trace=false;Session altered.SQL> select owner,object_name,original_name from dba_recyclebin where ts_name='TEST1';OWNE OBJECT_NAME ORIGINAL_NAME---- ------------------------------ --------------------------------W1 BIN$r6HZooW/xpzgQKjAb01Spw==$0 BW1 BIN$r6HZooXAxpzgQKjAb01Spw==$0 C