微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Oracle认证专家视频教程-OCP全套教程之学习笔记-闪回技术

知识要点

闪回数据库

使用闪回日志。闪回需要关闭数据库,只能用于特殊情况

创建flashback
sqlplus>shutdown immediate;
sqlplus>start mount;
sqlplus>alter system set db_recovery_file_dest_size=1G;
sqlplus>alter system set db_recovery_file_dest=’/u01/app/oracle/’;
sqlplus>alter database flash_back on;

时间点闪回

sqlplus>shutdown immediate;
sqlplus>startup mount;
sqlplus>flashback database to timestamp to_timestamp(‘2017-07-04 14:30:00’,’yyyy-mm-dd hh24:mi:ss’);

还原点闪回

创建可靠还原点
sqlplus>create restore point b4 guarantee flashback database;
flashback database to restore point b4;
查询可靠还原点
sqlplus>select * from v$restore_point;

闪回表

使用undo历史记录
1. 打开行移动
sqlplus>alter table scott.emp enable row movement;
2. 还原点闪回恢复
sqlplus>flashback table scott.emp to restore point b5;
3. 时间点闪回
sqlplus>flashback table scott.emp to timestamp to_timestamp(‘2017-07-04 15:05:32’,’yyyy-mm-dd hh24:mi:ss’);

闪回查询

指定时间闪回

sqlplus>select * from scott.emp as of timestamp to_timestamp(‘2017-07-04 15:53:32’,’yyyy-mm-dd hh24:mi:ss’);

闪回版本查询

sqlplus>select sal,versions_startscn,versions_endscn,versions_operation from scott.emp versions between scn minvalue and maxvalue where empno=7839;
sqlplus>select sal,versions_xid,versions_operation from scott.emp versions between timestamp sysdate-5/1440 and sysdate where empno=7839;

闪回事务查询

sqlplus>select undo_sql from flashback_transaction_query;

原文地址:https://www.jb51.cc/oracle/208612.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐