ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 使用Data Recovery Advisor诊断和修复failures

使用Data Recovery Advisor诊断和修复failures

原创 Linux操作系统 作者:pingley 时间:2012-04-21 22:49:46 0 删除 编辑
使用Data Recovery Advisor诊断和修复failures
今天在rman 上面敲了半天,晚上实在扛不住太累了。看了集电影回来准备敲敲sql。因为我今天把我修改的乱七八糟的hr schema 给drop 了。所以打算用脚本创建回来。出现了出现了数据库没有打开的错误,原来数据库没有open,那就open 吧,结果出现了下面的错误。
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/opt/oracle11g/oradata/oracl/system01.dbf'
ERROR at line 1:
ORA-01109: database not open
在rman 试一下看能够打开数据库,其实我知道肯定是open 不起来的,但是我还是决定要来这边试一试(这种侥幸心理不好)。open 不起来再来恢复。
[oracle@zeng ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Apr 21 22:16:07 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORACL (DBID=1821380921, not open)
RMAN> startup force
Oracle instance started
database mounted
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 04/21/2012 22:16:56
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/opt/oracle11g/oradata/oracl/system01.dbf'
现在来使用list failure 命令来查看下更详细的错误原因。该命令可以列出failures的优先级critical(致命),high(高),low(低),和failures 的状态open(未解决的),closed(已经关闭的)。
RMAN> list failure;
using target database control file instead of recovery catalog
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
1182       CRITICAL OPEN      21-APR-12     System datafile 1: '/opt/oracle11g/oradata/oracl/system01.dbf' needs media recovery
1185       HIGH     OPEN      21-APR-12     One or more non-system datafiles need media recovery
从list failure 的输出我们可以知道系统表空间的数据文件system01.dbf 需要执行介质恢复。一个或多个非系统表空间数据文件也需要执行介质恢复。下面使用advise failure 来看看Data Recovery Advisor 工具对这些failures 的修复提供了那些建议。
RMAN> advise failure;
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
1182       CRITICAL OPEN      21-APR-12     System datafile 1: '/opt/oracle11g/oradata/oracl/system01.dbf' needs media recovery
1185       HIGH     OPEN      21-APR-12     One or more non-system datafiles need media recovery
analyzing automatic repair options; this may take some time
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
analyzing automatic repair options complete
Mandatory Manual Actions
========================
no manual actions available
Optional Manual Actions
=======================
1. If you restored the wrong version of data file /opt/oracle11g/oradata/oracl/system01.dbf, then replace it with the correct one
2. If you restored the wrong version of data file /opt/oracle11g/oradata/oracl/sysaux01.dbf, then replace it with the correct one
3. If you restored the wrong version of data file /opt/oracle11g/oradata/oracl/undotbs01.dbf, then replace it with the correct one
4. If you restored the wrong version of data file /opt/oracle11g/oradata/oracl/users01.dbf, then replace it with the correct one
5. If you restored the wrong version of data file /opt/oracle11g/oradata/tbs.dbf, then replace it with the correct one
Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Recover database  
  Strategy: The repair includes complete media recovery with no data loss
  Repair script. /opt/oracle11g/diag/rdbms/oracl/oracl/hm/reco_1277731850.hm
强大的Data Recovery Advisor 提供了修复failures 的措施。下面来
尝试使用 repair failure 来修复failures。之所以说是尝试是因为Data Recovery Advisor不一定能够修复所有的错误,当执行完修复操作以后,Data Recovery Advisor 会重新评估所有存在的错误,以确定他们是否被修复,因为当修复一个failure 的时候可能会自动的修复由于该failure 引起的其他failures。如果在修复的过程中出现了错误,会触发
一次新的评估以查找错误并修复。因为Data Recovery Advisor并不是万能的所以他也会做出误判导致不能对症下药出现错误,所以需要“反省一次”。
RMAN> repair failure;
Strategy: The repair includes complete media recovery with no data loss
Repair script. /opt/oracle11g/diag/rdbms/oracl/oracl/hm/reco_1277731850.hm
contents of repair script.:
   # recover database
   recover database;
#repair failure 在执行实际修复操作之前需要用户确认。
Do you really want to execute the above repair (enter YES or NO)? yes
executing repair script
Starting recover at 21-APR-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /opt/oracle11g/oradata/oracl/system01.dbf
destination for restore of datafile 00002: /opt/oracle11g/oradata/oracl/sysaux01.dbf
destination for restore of datafile 00003: /opt/oracle11g/oradata/oracl/undotbs01.dbf
destination for restore of datafile 00004: /opt/oracle11g/oradata/oracl/users01.dbf
channel ORA_DISK_1: reading from backup piece /back/oracleback/incr_ORACL781201228281
channel ORA_DISK_1: piece handle=/back/oracleback/incr_ORACL781201228281 tag=TAG20120421T162028
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00005: /opt/oracle11g/oradata/tbs.dbf
channel ORA_DISK_1: reading from backup piece /back/oracleback/incr_ORACL781201284291
channel ORA_DISK_1: piece handle=/back/oracleback/incr_ORACL781201284291 tag=TAG20120421T162028
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /opt/oracle11g/oradata/oracl/system01.dbf
destination for restore of datafile 00002: /opt/oracle11g/oradata/oracl/sysaux01.dbf
destination for restore of datafile 00003: /opt/oracle11g/oradata/oracl/undotbs01.dbf
destination for restore of datafile 00004: /opt/oracle11g/oradata/oracl/users01.dbf
channel ORA_DISK_1: reading from backup piece /back/oracleback/incr_test0vn90cbk
channel ORA_DISK_1: piece handle=/back/oracleback/incr_test0vn90cbk tag=TAG20120421T162939
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00005: /opt/oracle11g/oradata/tbs.dbf
channel ORA_DISK_1: reading from backup piece /back/oracleback/incr_test10n90cdb
channel ORA_DISK_1: piece handle=/back/oracleback/incr_test10n90cdb tag=TAG20120421T162939
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 21-APR-12
repair failure complete
Do you want to open the database (enter YES or NO)? yes
database opened
以上是rman 执行介质恢复时候的信息输出,末尾询问你是否要open 数据库。
今日心得:
1、解决问题只是做对了一半,还需要找出问题的原因加以研究,以防后患。我这里是找不出这个问题的原因了。因为我今天用rman 执行了很多备份和恢复的练习,中途太累又看了一集电影。在返回rman中继续时,已经晕头转向搞不起是那些操作导致了不能open数据库。
2、学习不要把自己搞的太累,要注意方法。像我今天把自己搞的脑袋那么乱,那么累,有些失败。

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

上一篇: oracle 数据库的锁
请登录后发表评论 登录
全部评论

注册时间:2012-02-06

  • 博文量
    169
  • 访问量
    717383