flashback table 闪回表到指定时间或SCN
来源:互联网 发布:时代光华 知乎 编辑:程序博客网 时间:2024/05/14 00:14
闪回表特性:
闪回表是对闪回查询的增强。
实现表的闪回,需要使用到与撤销表空间相关的undo信息,通过show parameter undo命令可以了解这些信息。
用户对表数据的修改操作,都记录在撤销表空间中,这为表的闪回提供了数据恢复的基础。例如,某个修改操作在提交后被记录在撤销表空间中,保留时间为900秒,用户可以在这900秒的时间内对表进行闪回操作,从而将表中的数据恢复到修改之前的状态。
可以在线操作,恢复到指定时间点或SCN的任何数据
自动恢复相关属性,如索引,触发器,约束
满足分布式的一致性?
满足数据一致性,所有相关对象将自动一致。
闪回表不能将表恢复到改变表结构的DDL操作之前
需要打开row movement
使用的语句:
flashback table test1 to scn 11111;
flashback table test1 to timestamp to_timestamp('2013/06/23 19:17:00','yyyy/mm/dd hh24:mi:ss');
1.使用SCN闪回
22:47:39 SQL> select * from test;A
----------
1
2
4
22:47:45 SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
1938576
22:48:29 SQL> delete test;
3 rows deleted
22:48:35 SQL> commit;
Commit complete
22:48:37 SQL> flashback table test to scn 1938576;
flashback table test to scn 1938576
ORA-08189: cannot flashback the table because row movement is not enabled
22:49:02 SQL> alter table test enable row movement;
Table altered
22:49:20 SQL> flashback table test to scn 1938576;
Done
22:49:28 SQL> select * from test;
A
----------
1
2
4
2.使用时间戳闪回,alter table test enable row movement;上个例子已经做,这里不需要做。
SQL> set time on22:51:47 SQL> select * from test;
A
----------
1
2
4
22:56:03 SQL> delete test;
3 rows deleted.
22:56:07 SQL> commit;
Commit complete.
22:56:10 SQL> flashback table test to timestamp to_timestamp('2013/06/29 22:54:00','yyyy/mm/dd hh24:mi:ss');
Flashback complete.
22:57:20 SQL> select * from test;
A
----------
1
2
4
3.对表进行DDL后,无法闪回。
22:57:20 SQL> select * from test;A
----------
1
2
4
22:57:27 SQL>
22:59:05 SQL> drop table test;
Table dropped.
22:59:16 SQL> select * from test;
select * from test
*
ERROR at line 1:
ORA-00942: table or view does not exist
22:59:38 SQL> flashback table test to timestamp to_timestamp('2013/06/29 22:58:00','yyyy/mm/dd hh24:mi:ss');
flashback table test to timestamp to_timestamp('2013/06/29 22:58:00','yyyy/mm/dd hh24:mi:ss')
*
ERROR at line 1:
ORA-00942: table or view does not exist
4.此时可以使用闪回DROP
22:59:56 SQL> flashback table test to before drop;Flashback complete.
23:01:37 SQL> select * from test;
A
----------
1
2
4
- flashback table 闪回表到指定时间或SCN
- flashback之flashback table
- Flashback Table!
- flashback table
- flashback table
- Oracle Flashback之flashback table
- Oracle Flashback之flashback table
- Oracle flashback database to scn 实战
- SCN FlashBack 闪回常用语句
- Flashback Query Flashback Version Query Flashback Table Flashback Transaction
- flashback table 命令使用
- Flashback TABLE 实验
- Flashback Table 注意事项
- 关于flashback table
- FLASHBACK TABLE用法介绍
- 闪回表(Flashback table)运用
- Flashback Table闪回表
- flashback table恢复数据
- OpenCV 第八章 cvConvertHull2 (一)
- Libcurl使用入门教程
- Handle concurrency problem by Entity Framework
- HDU 4289 Control
- Python基础 3----Python函数及类
- flashback table 闪回表到指定时间或SCN
- HDU 2066 一个人的旅行
- gcc 编译过程简介
- 改变动画速率
- 线段树模板
- poj 1182食物链
- RCP 右键菜单片段
- 初学Oracle时遇到的一点问题以及解决办法
- 动画监听