加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-12 14:44:38 所属栏目:百科 来源:网络整理
导读:知识要点 闪回数据库 闪回表 闪回查询 闪回数据库 使用闪回日志。闪回需要关闭数据库,只能用于特殊情况 创建flashback sqlplusshutdown immediate; sqlplusstart mount; sqlplusalter system set db_recovery_file_dest_size=1G; sqlplusalter system set d

知识要点

  • 闪回数据库
  • 闪回表
  • 闪回查询

闪回数据库

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

创建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;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读