【对象管理】recyclebin

       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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值