普通用户误删表,没有清空回收站的情况 ,可以从闪回里恢复表
dba身份的用户没有闪回
===============================================
--闪回表
SQL> conn scott
Enter password:
Connected.
SQL> select * from dd;
DNO DNAME
-------------------- ----------
5
DD2011081901
DD2011081902
DD2011081903
DD2011081904
SQL> drop table dd;
Table dropped.
--查看闪回回收站
SQL> show recyclebin;
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
DD BIN$zlme+Jq+TPWQ+cSZ+Z/ubw==$0 TABLE 2011-08-23:12:10:15
STUINFO BIN$TkO8DBXCSQqQe2mitjBuVw==$0 TABLE 2011-08-19:18:21:03
STUINFO BIN$EBEnLx7gTiiwQryzTr2IKw==$0 TABLE 2011-08-19:18:20:12
STUINFO BIN$IyRCWH84TR6dWiF124+Wvw==$0 TABLE 2011-08-19:18:18:34
--闪回回收站可以查看表的内容,但要以现在的 recyclebin name 而不是以前的表面
SQL> select * from "BIN$zlme+Jq+TPWQ+cSZ+Z/ubw==$0";
DNO DNAME
-------------------- ----------
5
DD2011081901
DD2011081902
DD2011081903
DD2011081904
--将闪回回收站的dd表恢复删除之前
SQL> flashback table dd to before drop;
Flashback complete.
SQL> show recyclebin;
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
STUINFO BIN$TkO8DBXCSQqQe2mitjBuVw==$0 TABLE 2011-08-19:18:21:03
STUINFO BIN$EBEnLx7gTiiwQryzTr2IKw==$0 TABLE 2011-08-19:18:20:12
STUINFO BIN$IyRCWH84TR6dWiF124+Wvw==$0 TABLE 2011-08-19:18:18:34
--dd表已经恢复
SQL> select *from dd;
DNO DNAME
-------------------- ----------
5
DD2011081901
DD2011081902
DD2011081903
DD2011081904
--创建dd1表
SQL> create table dd1 as select * from dd;
Table created.
SQL> select * from dd1;
DNO DNAME
-------------------- ----------
5
DD2011081901
DD2011081902
DD2011081903
DD2011081904
--删除dd1并不放回收站
SQL> drop table dd1 purge;
Table dropped.
--闪回回收站不存在dd1表
SQL> show recyclebin;
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
STUINFO BIN$TkO8DBXCSQqQe2mitjBuVw==$0 TABLE 2011-08-19:18:21:03
STUINFO BIN$EBEnLx7gTiiwQryzTr2IKw==$0 TABLE 2011-08-19:18:20:12
STUINFO BIN$IyRCWH84TR6dWiF124+Wvw==$0 TABLE 2011-08-19:18:18:34
--dd1表已经删除,无法从闪回回收站恢复
SQL> select * from dd1;
select * from dd1
*
ERROR at line 1:
ORA-00942: table or view does not exist
--清空回收站
SQL> purge recyclebin;
Recyclebin purged.
--回收站已空
SQL> show recyclebin;
SQL>
==================================================