Chinaunix首页 | 论坛 | 博客
  • 博客访问: 863877
  • 博文数量: 72
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 435
  • 用 户 组: 普通用户
  • 注册时间: 2013-04-27 20:07
个人简介

郭一军,网名guoyJoe,尖峰在线培训创始人、Oracle OCM、ITPUB论坛Oracle认证版版主、2013最佳精华贴、Senior DBA、Oracle OCT、 ACOUG MEMBER、CSDN 认证专家、RHCE、在线技术分享的倡导者和实践者。 http://www.jianfengedu.com http://jianfengedu.taobao.com

文章分类
文章存档

2014年(72)

分类: Oracle

2014-06-19 10:38:28

转载请注明出处http://blog.csdn.net/guoyjoe/article/details/12361287



正确答案:AD

 

来自官方对CHANGE FAILURE command的语法解释,如下图所示:



changeFailure

This clause enables you to change the status of failures. Use the  FAILURE command to show the list of failures.

Syntax Element

Description

FAILURE

Enables you to change priority or close failures recorded in the Automatic Diagnostic Repository. By default RMAN prompts for confirmation before performing the requested change.

The target database to which RMAN is connected must be a single-instance database and must not be a physical standby database.

   ALL

Changes only open failures.

   CRITICAL

Changes only critical failures.

   HIGH

Changes only failures with HIGH priority.

   LOW

Changes only failures with LOW priority.

   failnum

Changes only the specified failure.


   EXCLUDE FAILURE
   failnum

Excludes the specified failures from the change.

 

         CHANGE FAILURE 命令用于更改故障优先级或关闭一个或多个故障,只能将故障优先级从HIGH 更改为LOW 和从LOW 更改为HIGH。当更改CRITICAL 优先级时会出现错误。(将故障的优先级从HIGH 更改为LOW 的一个原因是为了避免该故障显示在LIST FAILURE 命令的默认输出列表中。例如,如果块损坏具有HIGH 优先级,则该块位于很少使用的表空间中时,您可能希望将其临时更改为LOW。)修复故障后,将隐式关闭打开的故障。但是,也可以显式关闭故障。这需要重新评估其它所有打开的故障,因为其中的某些故障会因故障关闭而变得不相关。默认情况下,该命令要求用户确认请求的更改。


实验测试:

1丶 用rman登录备份数据库

[oracle@mydb ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Sun Oct 6 22:36:36 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: OCM (DBID=2206937749)

RMAN>  LIST FAILURE;

using target database control file instead of recovery catalog
no failures found that match specification

RMAN> backup database;

Starting backup at 06-OCT-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=145 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ocm/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/ocm/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/ocm/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ocm/undotbs01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/ocm/gyj01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/ocm/gyj02.dbf
input datafile file number=00008 name=/u01/app/oracle/oradata/ocm/tp01.dbf
input datafile file number=00009 name=/u01/app/oracle/oradata/ocm/mrkt01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ocm/users01.dbf
channel ORA_DISK_1: starting piece 1 at 06-OCT-13
channel ORA_DISK_1: finished piece 1 at 06-OCT-13
piece handle=/u01/app/oracle/product/11.2.0/dbs/14olopg6_1_1 tag=TAG20131006T223654 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
Finished backup at 06-OCT-13

Starting Control File and SPFILE Autobackup at 06-OCT-13
piece handle=/backup/rman/c-2206937749-20131006-00 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-13

2丶 删除某个数据文件

[root@mydb 6446]# rm -rf /u01/app/oracle/oradata/ocm/gyj02.dbf 数据库宕机

3 数据库宕机

RMAN> shutdown abort;

Oracle instance shut down

4丶 启动数据库到mount;

RMAN> startup mount;

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     839282688 bytes

Fixed Size                     2233000 bytes
Variable Size                436211032 bytes
Database Buffers             394264576 bytes
Redo Buffers                   6574080 bytes


5丶  Listfailure 命令会显示任何open 状态的failures,并会优先显示critical highfailure,如果没有类似的failure,那么会显示low failures

     RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 10/06/2013 22:43:30
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: \'/u01/app/oracle/oradata/ocm/gyj02.dbf\'

RMAN>  LIST FAILURE;

List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
    2002       HIGH     OPEN      06-OCT-13     One or more non-system datafiles are missing

6丶 从上面的failure级别看是high,我现在用Changefailure 命令改变failure的级别为low。如果有一个failure,在我们没有修复之前,或者暂时不想修复,那么我们就可以调低它的级别,级别的修改不影响系统的正常使用。

    RMAN>  CHANGE FAILURE  2002  PRIORITY LOW;

List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
2002       HIGH     OPEN      06-OCT-13     One or more non-system datafiles are missing

Do you really want to change the above failures (enter YES or NO)? y
changed 1 failures to LOW priority

7丶 级别改低后,就不在修复的范围内了,但不影响其它恢复

    RMAN> LIST FAILURE;
using target database control file instead of recovery catalog
no failures found that match specification


8 显式地关闭,即恢复到原来的级别(从LOWHIGH

    RN> change failure all closed;

List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
2002       LOW      OPEN      06-OCT-13     One or more non-system datafiles are missing

Do you really want to change the above failures (enter YES or NO)? Y
closed 1 failures

9丶恢复数据库,并打开数据库

RMAN> LIST FAILURE;

List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
2002       HIGH     OPEN      06-OCT-13     One or more non-system datafiles are missing
RMAN> advise failure;

List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
2002       HIGH     OPEN      06-OCT-13     One or more non-system datafiles are missing

analyzing automatic repair options; this may take some time
using channel ORA_DISK_1
analyzing automatic repair options complete

Mandatory Manual Actions
========================
no manual actions available

Optional Manual Actions
=======================
1. If file /u01/app/oracle/oradata/ocm/gyj02.dbf was unintentionally renamed or moved, restore it

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Restore and recover datafile 7  
  Strategy: The repair includes complete media recovery with no data loss
  Repair script: /u01/app/oracle/diag/rdbms/ocm/ocm/hm/reco_2745581618.hm

RMAN> repair failure;

Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/oracle/diag/rdbms/ocm/ocm/hm/reco_2745581618.hm

contents of repair script:
   # restore and recover datafile
   restore datafile 7;
   recover datafile 7;
   sql \'alter database datafile 7 online\';

Do you really want to execute the above repair (enter YES or NO)? y
executing repair script

Starting restore at 06-OCT-13
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 00007 to /u01/app/oracle/oradata/ocm/gyj02.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbs/14olopg6_1_1
channel ORA_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbs/14olopg6_1_1 tag=TAG20131006T223654
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 06-OCT-13

Starting recover at 06-OCT-13
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:01

Finished recover at 06-OCT-13

sql statement: alter database datafile 7 online
repair failure complete

Do you want to open the database (enter YES or NO)? y
database opened

答案A正确,CHANGE FAILURE 命令只能将故障优先级从HIGH 更改为LOW 和从LOW 更改为HIGH;

答案B不正确,CHANGE FAILURE 命令改变了级别后,就不能在修复范围之内了。

答案C不正确,CHANGE FAILURE 命令用于更改故障优先级或关闭一个或多个故障,只能将故障优先级从HIGH 更改为LOW 和从LOW 更改为HIGH。当更改CRITICAL 优先级时会出现错误。

答案D正确,可以显式关闭打开的故障。


QQ:252803295

技术交流QQ群:
DSI&Core Search  Ⅰ 群:127149411(2000人技术群:未满)
DSI&Core Search  Ⅱ 群:177089463(1000人技术群:未满)
DSI&Core Search  Ⅲ 群:284596437(500人技术群:未满)
DSI&Core Search  Ⅳ 群:192136702(500人技术群:未满)
DSI&Core Search  Ⅴ 群:285030382(500人闲聊群:未满)


MAIL:dbathink@hotmail.com

BLOG: http://blog.csdn.net/guoyjoe

WEIBO:

ITPUB: http://www.itpub.net/space-uid-28460966.html

OCM:   


阅读(1759) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~