recyclebin,也称为回收站,用于存放DROP后的对象。其用于非SYSTEM表空间、段空间管理为AUTO的环境中。
一、recyclebin里面的对象。
当删除了表空间、用户、聚集、TYPE的时候,其中的对象不会保留在回收站中,也就是说,在这些对象下的表不能通过flashback table <table_name> to before drop来进行恢复。另外删除表的时候,会同时删除表的索引、触发器等对象;
----删除了表空间后,其对象不会在回收站里面
SQL> create tablespace test04
2 logging
3 datafile 'D:\APP\ASUS\ORADATA\TEST\TEST04.DBF' SIZE 10M AUTOEXTEND ON NEXT 2M MAXSIZE 16M
4 EXTENT MANAGEMENT LOCAL;
表空间已创建。
SQL> create table t2(id int);
表已创建。
SQL> begin
2 for i in 1..10 loop
3 insert into t2
4 select i from dual;
5 end loop;
6 end;
7 /
PL/SQL 过程已成功完成。
SQL> drop tablespace test04 including contents and datafiles;
表空间已删除。
SQL> show recyclebin;
SQL> select * from user_recyclebin;
未选定行
-----删除了用户,用户下的对象不会在回收站里面;
SQL> create user t1 identified by 123;
用户已创建。
SQL> grant connect ,resource to t1;
授权成功。
SQL> conn t1/123@test;
已连接。
SQL> create table t(id int);
表已创建。
SQL> begin
2 for i in 1..10 loop
3 insert into t
4 select i from dual;
5 end loop;
6 end ;
7 /
PL/SQL 过程已成功完成。
SQL> conn sh/123456@test;
已连接。
SQL> drop user t1 cascade;
用户已删除。
SQL> show recyclebin;
SQL> select * from user_recyclebin;
未选定行
------删除聚集后,聚集中的对象不在recyclebin中;
SQL> create cluster clus
2 (department_id number(6))
3 size 512
4 storage(initial 100k next 20k);
簇已创建。
SQL> create table dept1
2 cluster clus(department_id)
3 as
4 select * from employees where department_id =10;
SQL> drop cluster clus;
簇已删除。
SQL> show recyclebin;
SQL> select * from user_recyclebin;
未选定行
----删除TYPE后,其对象也都不会保存在回收站中
SQL> create or replace type strings
2 as varray(3) of varchar2(30 char);
3 /
类型已创建。
SQL> drop type strings;
类型已删除。
SQL> show recyclebin;
SQL> select * from user_recyclebin;
未选定行
SQL> create table test01(
2 id int primary key,
3 num i