时间:2021-07-01 10:21:17 帮助过:42人阅读
flashback相当于是不完全恢复,drop table:被删除的表之似乎被改了表名,并没有真的被drop(windows的回收站)--gt;flash dr
flashback相当于是不完全恢复,drop table:被删除的表之似乎被改了表名,,并没有真的被drop(windows的回收站)-->flash dropped table 技术
SQL> show recyclebin
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
EDU234 BIN$kW6q/O9z4TDgQKjAFAEkeg==$0 TABLE 2010-09-30:07:53:27
SQL> purge recyclebin;
Recyclebin purged.
SQL> show recyclebin
则没有了,所以我们删除表,如果没有加上purge,是可以利用闪回技术把表恢复回来的
SQL> create table tsql01 (a number);
Table created.
SQL> insert into tsql01 values (1); //创建一张表,插入值,并且提交
1 row created.
SQL> commit;
Commit complete.
SQL> show recyclebin //先看下回收站里有没有被回收的事物,有则purge recyclebin
SQL> drop table tsql01; //并没有purge table tsql01 purge
Table dropped.
SQL> show recyclebin //会出现在recyclebin里面,刚才被删除的表,只不过名字被换成乱七八糟了
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
TSQL01 BIN$lIkhIeT93AfgQKjAWgAetg==$0 TABLE 2010-11-08:18:31:39
SQL> select * from "BIN$lIkhIeT93AfgQKjAWgAetg==$0"; //我们可以查找出这个值是多少
A
----------
1
SQL> select * from tsql01; //通过原先的表名是查不到的,因为已经被删除了
select * from tsql01
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> flashback table tsql01 to before drop; //闪回删除表恢复,不需要开启闪回的功能
Flashback complete.
SQL> conn /as sysdba
Connected.
SQL> select flashback_on from v$database; //闪回功能是关闭的
FLASHBACK_ON
------------------
NO
SQL>
SQL> select * from tsql01; //表已经恢复了
A
----------
1
所以如果我们确定那张表不要了,又为了不让别人看得见,那就加上purge吧
SQL> create table tsql02 (a number);
Table created.
SQL> insert into tsql02 values(2);
1 row created.
SQL> commit;
Commit complete.
SQL> drop table tsql02 purge;//删除的时候加上了purge
Table dropped.
SQL> show recyclebin //则不会进入recyclebin,recycle默认是开着的
SQL>
#########################