本文主要是介绍闪回删除实验,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
--查看回收站功能是否打开
SYS@PROD1> show parameter recyclebinNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
recyclebin string on--模拟闪回删除
SYS@PROD1> conn scott/tiger
Connected.
SCOTT@PROD1> create table e as select * from emp;Table created.SCOTT@PROD1> drop table e;Table dropped.SCOTT@PROD1> create table e as select * from dept;Table created.SCOTT@PROD1> drop table e;Table dropped.SCOTT@PROD1> show recyclebin --有两个相同的表e
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
E BIN$RMuxCbAfEP/gU0edqMDlhQ==$0 TABLE 2016-12-29:21:02:12
E BIN$RMuxCbAeEP/gU0edqMDlhQ==$0 TABLE 2016-12-29:21:02:02
SCOTT@PROD1> desc "BIN$RMuxCbAfEP/gU0edqMDlhQ==$0"Name Null? Type----------------------------------------------------- -------- ------------------------------------DEPTNO NUMBER(2)DNAME VARCHAR2(14)LOC VARCHAR2(13)SCOTT@PROD1> desc "BIN$RMuxCbAeEP/gU0edqMDlhQ==$0"Name Null? Type----------------------------------------------------- -------- ------------------------------------EMPNO NUMBER(4)ENAME VARCHAR2(10)JOB VARCHAR2(9)MGR NUMBER(4)HIREDATE DATESAL NUMBER(7,2)COMM NUMBER(7,2)DEPTNO NUMBER(2)SCOTT@PROD1> flashback table "BIN$RMuxCbAfEP/gU0edqMDlhQ==$0" to before drop;Flashback complete.SCOTT@PROD1> desc eName Null? Type----------------------------------------------------- -------- ------------------------------------DEPTNO NUMBER(2)DNAME VARCHAR2(14)LOC VARCHAR2(13)SCOTT@PROD1> show recycle bin
SCOTT@PROD1> show recyclebin
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
E BIN$RMuxCbAeEP/gU0edqMDlhQ==$0 TABLE 2016-12-29:21:02:02--表名存在需要rename to改名。
SCOTT@PROD1> flashback table "BIN$RMuxCbAeEP/gU0edqMDlhQ==$0" to before drop rename to old_e;Flashback complete.SCOTT@PROD1> desc old_e Name Null? Type----------------------------------------------------- -------- ------------------------------------EMPNO NUMBER(4)ENAME VARCHAR2(10)JOB VARCHAR2(9)MGR NUMBER(4)HIREDATE DATESAL NUMBER(7,2)COMM NUMBER(7,2)DEPTNO NUMBER(2)--清空回收站
SCOTT@PROD1> purge recyclebin; --清当前Recyclebin purged.SYS@PROD1> purge dba_recyclebin; --清所有DBA Recyclebin purged.
这篇关于闪回删除实验的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!