测试数据文件的删除

SQL> drop table tests;

Table dropped.

SQL> create table tests as select owner,tablespace_name,table_name from all_tables;

Table created.

SQL> insert into tests select * from tests;

1577 rows created.

SQL> /

3154 rows created.

SQL> /

6308 rows created.

SQL> /
insert into tests select * from tests
*
ERROR at line 1:
ORA-01653: unable to extend table DEMO.TESTS by 8 in tablespace TESTS


SQL> /
insert into tests select * from tests
*
ERROR at line 1:
ORA-01653: unable to extend table DEMO.TESTS by 8 in tablespace TESTS


SQL> alter tablespace tests add datafile '/u01/app/oracle/oradata/ORCL/datafile/test2.dbf' size 4m;

Tablespace altered.

SQL> insert into tests select * from tests;

12616 rows created.

SQL> commit;

Commit complete.


----1--------------------delete & move ---------------------------------------------------


SQL> delete tests t1 where t1.rowid not in(select min(rowid) from tests t group by owner,table_name,tablespace_name);

11039 rows deleted.

SQL> alter tablespace tests drop datafile '/u01/app/oracle/oradata/ORCL/datafile/test2.dbf';
alter tablespace tests drop datafile '/u01/app/oracle/oradata/ORCL/datafile/test2.dbf'
*
ERROR at line 1:
ORA-03262: the file is non-empty

    SQL> alter table tests move;

Table altered.

SQL> alter tablespace tests drop datafile '/u01/app/oracle/oradata/ORCL/datafile/test2.dbf';

Tablespace altered.

SQL>

-------2-------------------------------truncate --------------------------------------------

SQL> truncate table tests;

Table truncated.

SQL> alter tablespace tests drop datafile '/u01/app/oracle/oradata/ORCL/datafile/test2.dbf';

Tablespace altered.

---------3----------------------------drop -----------------------------------------------------

SQL> drop table tests;

Table dropped.

SQL> alter tablespace tests drop datafile '/u01/app/oracle/oradata/ORCL/datafile/test2.dbf';
alter tablespace tests drop datafile '/u01/app/oracle/oradata/ORCL/datafile/test2.dbf'
*
ERROR at line 1:
ORA-03262: the file is non-empty

SQL> purge recyclebin;

Recyclebin purged.

SQL> alter tablespace tests drop datafile '/u01/app/oracle/oradata/ORCL/datafile/test2.dbf';

Tablespace altered.


--------------------end---------------------------------------------------------------------------

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值