ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 11g data recovery advisor

11g data recovery advisor

原创 Linux操作系统 作者:安佰胜 时间:2011-11-09 09:32:21 0 删除 编辑
 
11g data recovery advisor
 
====================
 
11g中添加data recovery advisor模块
通过rman中的list、repair等几条命令来实现
list查看failure也可以查看多个级别的错误
list failure critical
list failure high
list failure low
list failure closed
list failure open

--模拟错误
--关闭数据库后将数据文件users01.dbf重命名
--重启数据库将会报错找不到数据文件
 
[oracle@localhost db11]$ mv users01.dbf users01.dbf_ttt

[oracle@localhost db11]$ sqlplus  / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Nov 8 11:42:18 2011
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area  313860096 bytes
Fixed Size                  1336232 bytes
Variable Size             188746840 bytes
Database Buffers          117440512 bytes
Redo Buffers                6336512 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '/oracle/oradata/db11/db11/users01.dbf'

-------------------------
--登录rman查看failure
 
[oracle@localhost 2011_11_08]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Nov 8 11:43:30 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: DB11 (DBID=1298141643, not open)
 
 
--list能够列出failure等级、状态、发现时间以及简单描述
RMAN> list failure;

using target database control file instead of recovery catalog
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
302        HIGH     OPEN      08-NOV-11     One or more non-system datafiles are missing
 
 
 
--进一步可以查看对应failure的更详细情况
 
 
RMAN> list failure 302 detail;
 
 
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
302        HIGH     OPEN      08-NOV-11     One or more non-system datafiles are missing
  Impact: See impact for individual child failures
  List of child failures for parent failure ID 302
  Failure ID Priority Status    Time Detected Summary
  ---------- -------- --------- ------------- -------
  305        HIGH     OPEN      08-NOV-11     Datafile 4: '/oracle/oradata/db11/db11/users01.dbf' is missing
    Impact: Some objects in tablespace USERS might be unavailable
 
 
 
--通过advise命令,系统可以给出错误的处理建议
 
 
RMAN> advise failure;

 
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
302        HIGH     OPEN      08-NOV-11     One or more non-system datafiles are missing
  Impact: See impact for individual child failures
  List of child failures for parent failure ID 302
  Failure ID Priority Status    Time Detected Summary
  ---------- -------- --------- ------------- -------
  305        HIGH     OPEN      08-NOV-11     Datafile 4: '/oracle/oradata/db11/db11/users01.dbf' is missing
    Impact: Some objects in tablespace USERS might be unavailable
analyzing automatic repair options; this may take some time
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=17 device type=DISK
analyzing automatic repair options complete
Mandatory Manual Actions
========================
no manual actions available
Optional Manual Actions
=======================
1. If file /oracle/oradata/db11/db11/users01.dbf was unintentionally renamed or moved, restore it
Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Restore and recover datafile 4 
  Strategy: The repair includes complete media recovery with no data loss
  Repair script. /opt/app/oracle/diag/rdbms/db11/db11/hm/reco_3726388055.hm
 
 
--预览建议对错误的修复
--同时会给出实际恢复的时候使用的命令
 
 
RMAN> repair failure preview;

 
Strategy: The repair includes complete media recovery with no data loss
Repair script. /opt/app/oracle/diag/rdbms/db11/db11/hm/reco_3726388055.hm
contents of repair script.:
   # restore and recover datafile
   restore datafile 4;
   recover datafile 4;
 
 
--确实修复问题
--中间会交互提示是否确实要修复问题
--以及是否启动数据库
--我统统选择yes
 
 
RMAN> repair failure;
 
 
Strategy: The repair includes complete media recovery with no data loss
Repair script. /opt/app/oracle/diag/rdbms/db11/db11/hm/reco_3726388055.hm
contents of repair script.:
   # restore and recover datafile
   restore datafile 4;
   recover datafile 4;
Do you really want to execute the above repair (enter YES or NO)? yes
executing repair script
Starting restore at 08-NOV-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00004 to /oracle/oradata/db11/db11/users01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/flash_recovery_area/DB11/backupset/2011_11_08/o1_mf_nnndf_TAG20111108T112236_7ck83wn9_.bkp
channel ORA_DISK_1: piece handle=/oracle/flash_recovery_area/DB11/backupset/2011_11_08/o1_mf_nnndf_TAG20111108T112236_7ck83wn9_.bkp tag=TAG20111108T112236
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 08-NOV-11
Starting recover at 08-NOV-11
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 08-NOV-11
repair failure complete
Do you want to open the database (enter YES or NO)? yes
database opened
 

 
--数据库已经启动,登录sqlplus查看,数据库打开的状况和文件情况
--一切恢复正常
 
 
SQL> SQL> SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
 
 
SQL> select name from v$dbfile;
NAME
--------------------------------------------------------------------------------
/oracle/oradata/db11/db11/users01.dbf
/oracle/oradata/db11/db11/undotbs01.dbf
/oracle/oradata/db11/db11/sysaux01.dbf
/oracle/oradata/db11/db11/system01.dbf
 
 

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

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

注册时间:2009-08-26

  • 博文量
    215
  • 访问量
    660342