我们知道Oracle有一个回收站的功能,如果删除表的时候不使用purge选项,则会进入到回收站,可以使用Flashback闪回删除。具体如下:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
SQL> conn hr/hr
Connected.
SQL> show recyclebin;
SQL> drop table emptest;
Table dropped.
SQL> show recyclebin;
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
EMPTEST BIN$LyW+XZMEovjgU5XmqMB6SA==$0 TABLE 2016-03-29:08:02:22
SQL> flashback table emptest to before drop;
Flashback complete.
SQL> show recyclebin;
SQL>
但是如果是SYS用户删除位于SYSTEM表空间的表,似乎是彻底删除,不会进入回收站。具体如下:
SQL> conn / as sysdba
Connected.
SQL> show recyclebin;
SQL> create table emptest as select * from hr.employees;
Table created.
SQL> select table_name,tablespace_name from dba_tables where table_name='EMPTEST' and owner='SYS';
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
EMPTEST SYSTEM
SQL> drop table emptest;
Table dropped.
SQL> show recyclebin;
SQL>
SQL> flashback table emptest to before drop;
flashback table emptest to before drop
*
ERROR at line 1:
ORA-38305: object not in RECYCLE BIN
闪回报错。
创建在其他表空间后删除会进入到回收站。
SQL> create table emptest tablespace users as select * from hr.employees;
Table created.
SQL> drop table emptest;
Table dropped.
SQL> show recyclebin;
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
EMPTEST BIN$LycThzsSsx3gU5XmqMDJHQ==$0 TABLE 2016-03-29:09:47:33
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28536251/viewspace-2072563/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28536251/viewspace-2072563/