Oracle不完全恢复指的是恢复的数据有丢失,部分数据恢复不了。

环境:

OS: rhel 6.0

DB:oracle 10.2.0.1.0

1,首先有数据库的备份

这里采用的是rman的全备
[oracle@rhel ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Fri Apr 27 09:26:26 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL10 (DBID=3989340674)

RMAN> backup database;
2,创建测试表
SQL> create table emp2 as select * from emp;
查看当前的日志状况
SQL> select * from v$log;

GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS    FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1    1       2   52428800     1 YES ACTIVE         584685 27-APR-12
2    1       1   52428800     1 YES ACTIVE         584369 27-APR-12
3    1       3   52428800     1 NO  CURRENT         584693 27-APR-12

3,插入数据,提交并且切换日志
SQL> insert into emp2  select * from emp2;

14 rows created.

SQL> commit;
SQL> alter system switch logfile;
SQL> insert into emp2  select * from emp2;

28 rows created.

SQL> commit;

Commit complete.
4,模拟断点,丢失online redolog
SQL> shutdown abort
[oracle@rhel orcl10]$ rm -rf redo0*  
尝试打开数据库,提示:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/opt/oracle/product/10.2.0/oradata/orcl10/redo03.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
查看online redolog日志的状态
SQL> select * from v$log;

GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS    FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1    1       2   52428800     1 YES INACTIVE      584685 27-APR-12
3    1       3   52428800     1 YES ACTIVE      584693 27-APR-12
2    1       4   52428800     1 NO  CURRENT
active的状态表示在恢复的时候数据不同步
尝试对数据库进行不完全恢复,进行recover
SQL> recover database until cancel;
ORA-00279: change 584693 generated at 04/27/2012 09:28:19 needed for thread 1
ORA-00289: suggestion : /opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_3_%u_.arc
ORA-00280: change 584693 for thread 1 is in sequence #3

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 584825 generated at 04/27/2012 09:33:36 needed for thread 1
ORA-00289: suggestion : /opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_4_%u_.arc
ORA-00280: change 584825 for thread 1 is in sequence #4
ORA-00278: log file '/opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_3_7so81kbk_.arc' no longer needed for this recovery

ORA-00308: cannot open archived log '/opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_4_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/product/10.2.0/oradata/orcl10/system01.dbf'
后面提示的错误表示存在数据文件不同步
5,从最近的备份中转储所有的数据文件,除offline文件和readonly文件以后,转储到目标位置
[oracle@rhel ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Fri Apr 27 09:40:57 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL10 (DBID=3989340674, not open)

RMAN> restore database;

6,对数据库进行recover
SQL> recover database until cancel;
ORA-00279: change 584626 generated at 04/27/2012 09:26:32 needed for thread 1
ORA-00289: suggestion : /opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_1_%u_.arc
ORA-00280: change 584626 for thread 1 is in sequence #1

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 584685 generated at 04/27/2012 09:28:13 needed for thread 1
ORA-00289: suggestion : /opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_2_%u_.arc
ORA-00280: change 584685 for thread 1 is in sequence #2
ORA-00278: log file '/opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_1_7so7qh5g_.arc' no longer needed for this recovery

ORA-00279: change 584693 generated at 04/27/2012 09:28:19 needed for thread 1
ORA-00289: suggestion : /opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_3_%u_.arc
ORA-00280: change 584693 for thread 1 is in sequence #3
ORA-00278: log file '/opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_2_7so7qn5h_.arc' no longer needed for this recovery

ORA-00279: change 584825 generated at 04/27/2012 09:33:36 needed for thread 1
ORA-00289: suggestion : /opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_4_%u_.arc
ORA-00280: change 584825 for thread 1 is in sequence #4
ORA-00278: log file '/opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_3_7so81kbk_.arc' no longer needed for this recovery

ORA-00308: cannot open archived log '/opt/oracle/product/10.2.0/flash_recovery_area/ORCL10/archivelog/2012_04_27/o1_mf_1_4_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
此时没有"ORA-01194: file 1 needs more recovery to be consistent"的提示,我们可以打开数据库。
7,打开数据库
SQL> alter database open resetlogs;

Database altered.
SQL> select * from v$log;

GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS    FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1    1       0   52428800     1 YES UNUSED 0
2    1       1   52428800     1 NO  CURRENT   584826 27-APR-12
3    1       0   52428800     1 YES UNUSED 0
8,查看数据
SQL> select count(*) from emp2;

COUNT(*)
----------
28
显示的数据是我们在切换日志之前的数据,切换日志之后的日志丢失。
9.基于时间点的不完全恢复
我们需要从alert日志中或是从online redolog 日志中查询到需要恢复的时间点,转储备份文件到目标数据库
执行
recover database until time '2012-04-27 12:46:23';
alter database open resetlogs;

Oracle不完全恢复相关推荐

  1. ORACLE不完全恢复的几种情况

    ORACLE不完全恢复的几种情况 1.介绍 RMAN不完全恢复的三个标准模式:基于time.基于scn和基于sequence,与手工不完全恢复相比原理类似,语法稍有不同: 2.不完全恢复的几种情况 # ...

  2. Oracle不完全恢复-主动恢复和incarnation/RMAN-20208/RMAN-06004

    12.3 主动恢复 主动不完全恢复是将数据库"撤回"到从前的传统方法,主要用来撤销认为修改.一般需要先判断PIT点的时间或SCN --1 重启db到mount状态 --2 用res ...

  3. oracle06004,Oracle不完全恢复-主动恢复和incarnation/RMAN-20208/RMAN-06004

    12.3 主动恢复 主动不完全恢复是将数据库"撤回"到从前的传统方法,主要用来撤销认为修改.一般需要先判断PIT点的时间或SCN --1 重启db到mount状态 --2 用res ...

  4. SQL 与 ORACLE 的比较

    最近参加了一个ORACLE的培训,ORACLE与平日惯用的SQL SERVER果然有很大不同,在网上搜索了一下转了这篇比较SQL与ORACLE的帖子,总体上感觉SQL SERVER使用更加便捷,人性化 ...

  5. oracle将千万行查询优化到一秒内,oracle下一条SQL语句的优化过程(比较详细)

    oracle下一条SQL语句的优化过程(比较详细) 更新时间:2010年04月14日 23:56:49   作者: 很简单的一次调整,语句加了适当的索引后性能就有大幅的提升.当时看到这条语句的时候,第 ...

  6. SQL与Oracle对比

    关键字: SQL,ORACLE 分类: 个人专区 密级: 公开 (评分:★★★★ , 回复: 16, 阅读: 641) »» 本人平时比较沉默,但朋友们都说我很疯狂-疯狂地学习.疯狂地工作.很久就 ...

  7. CUUG笔记--oracle备份和恢复

    免费网络课程<Oracle备份与恢复>,旨在深入的探讨Oracle备份与恢复的真谛,剖析备份与恢复的原理,通过各种真实的案例,全面的诠释Oracle数据库完全恢复.不完全恢复.无备份恢复, ...

  8. Oracle恢复手册

    一.前言 常言道-"有备无患",备份对于一套数据库来说十分重要,当遇到天灾人祸的时候有效的备份是数据库最后的希望,也是DBA从业人员自救的最后手段.一款不错的备份软件,一个适用的备 ...

  9. oracle数据库恢复aul_RMAN备份与恢复 —— 完全恢复与不完全恢复

    名词解释: 顾名思义,完全恢复就是指数据没有丢失的恢复了.不完全恢复是指恢复后有部分数据丢失.它们是数据库的两种恢复方式. 完全恢复:利用重做日志或增量备份将数据块恢复到最接近当前时间的时间点.之所以 ...

最新文章

  1. Know about Oracle RAC Heartbeat
  2. Dalvik VM的主要特征
  3. 高仿美团钱包首页CollapsingToolbarLayout监听滑动隐藏效果(公司项目)
  4. PHP(一)——概述及服务器配置
  5. Tensorflow框架:InceptionV3网络概念及实现
  6. android用上传图片到服务器上,Android使用post方式上传图片到服务器的方法
  7. 老男孩教育学员参观机房实践活动
  8. Mybatis3.4.x技术内幕(十七):Mybatis之动态Sql设计原本(上)
  9. meta分析的基本步骤是什么-附实例讲解,meta分析七步快速见刊策略
  10. 计算机应用基础项目化教程ppt,计算机应用基础项目化教程_课件
  11. 清华大学保研计算机推荐信模板,清华保研推荐信模板
  12. 路由器登录校园网解决终端限制问题
  13. JUCE框架教程(3)—— Component ClassGraphics入门
  14. Linux -- 查找文件内容或文件位置
  15. android高仿朋友圈,高仿微信朋友圈图片展示效果 ImageWatcher
  16. ie ajax十分卡,解决JQuery .ajax 在IE下卡死问题
  17. 建筑力学与结构【9】
  18. Python Tic Tac Toe游戏
  19. 设备树使用手册【转】
  20. 如何才能成为一名优秀的设计师?

热门文章

  1. KS和IV的区分比较
  2. 通过HFS低成本搭建NAS,并内网穿透实现公网访问 1/2
  3. 【PyQt】PyQt+百度API实现图像识别应用(附代码)
  4. 梅森数形如2n−1的素数称为梅森数(Mersenne Number)
  5. TCP/IP协议详解(TCP/IP protocol)
  6. 【信管1.6】计算机网络基础(四)网络规划与数据软件
  7. 《自律让你自由》摘要
  8. 《汇编语言》第10章 call和ret指令
  9. Python nbs***bsp; 乱码
  10. Android Crash:Bad notification for startForeground