ITPub博客

首页 > 数据库 > Oracle > flashback恢复特定数据文件

flashback恢复特定数据文件

原创 Oracle 作者:BogengWang 时间:2015-06-03 16:38:44 1 删除 编辑
今天看见群里讨论flashback,我在虚机上尝试了一下。
先做了如下操作:

点击(此处)折叠或打开

  1. SQL> create restore point p1;
  2. Restore point created.
  3. SQL> create tablespace flash datafile \'/u01/app/oracle/oradata/gg1/flash01.dbf\' size 8m;
  4. Tablespace created.
  5. SQL> grant connect,resource to flash identified by flash;
  6. Grant succeeded.
  7. SQL> create table flash.emp as select * from scott.emp;
  8. Table created.
  9. SQL> create restore point p2;
  10. Restore point created.
  11. SQL> truncate table flash.emp;
  12. Table truncated.
  13. SQL> create restore point p3;
  14. Restore point created.
之后在操作系统上删除/u01/app/oracle/oradata/gg1/flash01.dbf这个新增的文件

然后开始闪回

点击(此处)折叠或打开

  1. SQL> shutdown immediate
  2. Database closed.
  3. Database dismounted.
  4. ORACLE instance shut down.
  5. SQL> startup mount
  6. ORACLE instance started.
  7. Total System Global Area 661209088 bytes
  8. Fixed Size 1338560 bytes
  9. Variable Size 423625536 bytes
  10. Database Buffers 230686720 bytes
  11. Redo Buffers 5558272 bytes
  12. Database mounted.
  13. SQL>
  14. SQL> flashback database to restore point p3;
  15. Flashback complete.
在告警日志中发现如下信息:

点击(此处)折叠或打开

  1. Mon Mar 09 21:41:08 2015
  2. flashback database to restore point p3
  3. Mon Mar 09 21:41:08 2015
  4. Errors in file /u01/app/oracle/diag/rdbms/gg1/gg1/trace/gg1_dbw0_7668.trc:
  5. ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
  6. ORA-01110: data file 7: \'/u01/app/oracle/oradata/gg1/flash01.dbf\'
  7. ORA-27037: unable to obtain file status
  8. Linux Error: 2: No such file or directory
  9. Additional information: 3
  10. Flashback Restore Start
  11. Deleted file /u01/app/oracle/oradata/gg1/flash01.dbf
  12. Flashback: deleted datafile #7 in tablespace #7 from control file.
  13. Flashback: dropped tablespace #7: \'FLASH\' from the control file.
  14. Flashback Restore Complete
  15. Flashback Media Recovery Start
  16. Serial Media Recovery started
可见flashback,自动的帮助我们restore了datafile,真是意想不到啊。


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30202921/viewspace-1684288/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2015-04-11

  • 博文量
    22
  • 访问量
    70513