Oracle Study之案例--数据恢复神器Flashback(2)
1)06:52:29 SQL> select * from tab;TNAME TABTYPECLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
TEST TABLE
T01 TABLE
T02 TABLE
7 rows selected.
06:52:31 SQL> drop table t01;
Table dropped.
查看回收站:
06:52:38 SQL> show recycle;
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPEDROP TIME
---------------- ------------------------------ ------------ -------------------
T01 BIN$qrJLbL74ZgvgQKjA8Agb/A==$0 TABLE 2011-08-17:06:52:38
--------除了system 表空间,其余表空间都有一个类似windows 回收站,在drop table,实际上把table 改名后放入recyclebin。
06:52:44 SQL> flashback table t01 to before drop;
Flashback complete.
06:54:05 SQL> show recycle;
06:54:07 SQL>select * from tab;
TNAME TABTYPECLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
TEST TABLE
T01 TABLE
T02 TABLE
7 rows selected.
06:54:11 SQL> drop table t02 purge; //purge会彻底的删除table
Table dropped.
06:54:40 SQL> show recycle;
-----------清空recyclebin
06:54:43 SQL> drop table t01;
Table dropped.
06:55:49 SQL> show recycle;
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPEDROP TIME
---------------- ------------------------------ ------------ -------------------
T01 BIN$qrJLbL75ZgvgQKjA8Agb/A==$0 TABLE 2011-08-17:06:55:49
06:55:51 SQL> purge recyclebin;
Recyclebin purged.
06:55:57 SQL> show recycle;
06:55:59 SQL>
--------------如何恢复同一个schema 下同名的table
06:56:32 SQL> drop table test;
Table dropped.
06:56:42 SQL> create table test asselect * from emp;
Table created.
06:56:46 SQL> select * from tab;
TNAME TABTYPECLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
BIN$qrJLbL76ZgvgQKjA8Agb/A==$0 TABLE
TEST TABLE
6 rows selected.
06:56:50 SQL> show recycle;
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPEDROP TIME
---------------- ------------------------------ ------------ -------------------
TEST BIN$qrJLbL76ZgvgQKjA8Agb/A==$0 TABLE 2011-08-17:06:56:36
06:56:58 SQL> flashback table test to before drop;
flashback table test to before drop
*
ERROR at line 1:
ORA-38312: original name is used by an existing object
06:57:09 SQL> flashback table test to before drop rename to test_old;
Flashback complete.
06:57:32 SQL> select * from tab;
TNAME TABTYPECLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
TEST_OLD TABLE
TEST TABLE
6 rows selected.
flashback Drop不支持sys用户:
----system 表空间不存在recyclebin ,表直接被删除
06:57:36 SQL> conn /as sysdba
Connected.
06:58:33 SQL>
06:58:33 SQL> create table test as select * from user_tables;
Table created.
06:58:42 SQL> drop table test;
Table dropped.
06:58:46 SQL> show recycle;
闪回表回收站——3个视图
使用方面,闪回特性还要关注两个回收站视图。user_recyclebin、all_recyclebin、dba_recyclebin。
页:
[1]