ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 11gOCP精解 之 01

11gOCP精解 之 01

原创 Linux操作系统 作者:jhon_lee 时间:2012-09-22 09:59:46 0 删除 编辑
Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE

Identify two situations in which you can use Data Recovery Advisor for recovery. (Choose two.)

A. The user has dropped an important table that needs to be recovered.

B. The database files are corrupted when the database is open.

C. You are not able to start up the database instance because the required database files are missing.

D. The archived log files are missing for which backup is not available.

Answer: B,C

Explanation:


Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE

Data Recovery Advisor是oracle 11g推出且归属于rman的一种新特性,它是Oracle 11g Database 所推出的一种故障解决工具, 具有自动化得故障检测、故障定位、提出最优解决方案、按照用户的需求执行解决方案等功能;通常应用在数据文件腐坏或者磁盘上的永久数据丢失等极端环境中;通过提供一种集中式的自动的数据恢复工具,Data Recovery Advisor大大提高了数据库的易管理和可靠性,同时可以缩减MTTR(Mean Time To Repair 平均恢复时间);

 

Data Recovery Advisor具有如下优于传统恢复技术的特点:

1.    Data Recovery Advisor可以在数据库进程发现错误前进行探测、分析、修复数据等操作,同时发错警告信息。预警信息可以有效的遏制由于腐坏导致的损害

2.      Data Recovery Advisor 可以自动的分析失败信息,同时评估其影响,并且将报告发送给用户。这种自动化评估方式优于手动的错误统计方式,省时且高效

3.      以前,用户必须手动的通过修复可能带来的影响来确定修复选项,当遇到多种错误同时发生时,用户必须手动的确定正确恢复顺序。作为对比Data Recovery Advisor 可以自动化处理以上问题,既可以做出最好的恢复选项,又可以检测在你的计算机环境中最可行方案

4.      执行一个数据恢复可能是复杂且易出错的过程,当我们选择Data Recovery Advisor来执行一个自动化的恢复时可以同时验证其是否成功

 

实验:

模拟错误:将system01.dbf 重名名

实验前提:使用oracle11g数据库,保证数据库已经使用rman备份

实验内容:

1、常用指令介绍

Data Recovery Advisor 使用如下命令进行管理LIST FAILURE, ADVISE FAILURE, REPAIR FAILURE, and CHANGE FAILURE

 

list查看failure也可以包含多种子查询相关指令的使用方法可以查看官方文档,例如:

RMAN> LIST FAILURE ALL;   ···   Lists failures with all priorities and status OPEN.

RMAN> LIST FAILURE CRITICAL;  ···  Lists only critical failures with status OPEN.

RMAN> LIST FAILURE HIGH;  ···  Lists only failures with HIGH priority and status OPEN.

RMAN> LIST FAILURE LOW;   ···   Lists only failures with LOW priority with status OPEN.

RMAN> LIST FAILURE CLOSED;   ···         Lists only closed failures.

RMAN> LIST FAILURE  failureNumber;   ···    Specifies the failures by failure number.

RMAN> LIST FAILURE DETAIL; ···   Lists failures by expanding the consolidated failure. For example, if multiple block corruptions existed in a file, then specifying the DETAIL option would list each of the block corruption.

 

2、关闭数据库重命名system01.dbf文件

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>!mv /u01/app/oracle/oradata/oracle11g/system01.dbf /u01/app/oracle/oradata/oracle11g/system01.dbf_bk

 

3、打开数据库等待报错

SQL> startup

ORACLE instance started.

 

Total System Global Area  422670336 bytes

Fixed Size                  1336960 bytes

Variable Size             318769536 bytes

Database Buffers           96468992 bytes

Redo Buffers                6094848 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 1 - see DBWR trace file

ORA-01110: data file 1: '/u01/app/oracle/oradata/oracle11g/system01.dbf'

 

4、登陆rman查看报错

[oracle@oel11g ~]$ rman target /

 

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Sep 5 21:12:48 2012

 

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

 

connected to target database: ORACLE11 (DBID=2483499420, 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

---------- -------- --------- ------------- -------

102        CRITICAL OPEN      05-SEP-12     System datafile 1: '/u01/app/oracle/oradata/oracle11g/system01.dbf' is missing

 

5、可以进一步查看更详细的信息

RMAN> list failure 102 detail;

 

List of Database Failures

=========================

 

Failure ID Priority Status    Time Detected Summary

---------- -------- --------- ------------- -------

102        CRITICAL OPEN      05-SEP-12     System datafile 1: '/u01/app/oracle/oradata/oracle11g/system01.dbf' is missing

  Impact: Database cannot be opened

 

6、使用advise命令令系统给出错误的处理建议

RMAN> advise failure;

 

List of Database Failures

=========================

 

Failure ID Priority Status    Time Detected Summary

---------- -------- --------- ------------- -------

102        CRITICAL OPEN      05-SEP-12     System datafile 1: '/u01/app/oracle/oradata/oracle11g/system01.dbf' is missing

  Impact: Database cannot be opened

 

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/oracle11g/system01.dbf was unintentionally renamed or moved, restore it

 

Automated Repair Options

========================

Option Repair Description

------ ------------------

1      Restore and recover datafile 1

  Strategy: The repair includes complete media recovery with no data loss

  Repair script. /u01/app/diag/rdbms/oracle11g/oracle11g/hm/reco_2411470321.hm

 

7、使用repair failure preview指令预览修复情况且同时获取恢复使用的指令

RMAN>  repair failure preview;

 

Strategy: The repair includes complete media recovery with no data loss

Repair script. /u01/app/diag/rdbms/oracle11g/oracle11g/hm/reco_2411470321.hm

 

contents of repair script.:

   # restore and recover datafile

   restore datafile 1;

   recover datafile 1;

 

8、使用repair failure恢复数据库

中途会提示是否恢复错误,提示是否打开数据库,这里选择打开

RMAN> repair failure;

 

Strategy: The repair includes complete media recovery with no data loss

Repair script. /u01/app/diag/rdbms/oracle11g/oracle11g/hm/reco_2411470321.hm

 

contents of repair script.:

   # restore and recover datafile

   restore datafile 1;

   recover datafile 1;

 

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

Starting restore at 05-SEP-12

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 00001 to /u01/app/oracle/oradata/oracle11g/system01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/flash_recovery_area/ORACLE11G/backupset/2012_09_05/o1_mf_nnndf_TAG20120905T204753_84hwotbd_.bkp

channel ORA_DISK_1: piece handle=/u01/app/flash_recovery_area/ORACLE11G/backupset/2012_09_05/o1_mf_nnndf_TAG20120905T204753_84hwotbd_.bkp tag=TAG20120905T204753

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:02:28

Finished restore at 05-SEP-12

 

Starting recover at 05-SEP-12

using channel ORA_DISK_1

 

starting media recovery

media recovery complete, elapsed time: 00:00:08

 

Finished recover at 05-SEP-12

repair failure complete

 

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

database opened

 

9、数据库恢复后进行查看是否恢复成功

 

[oracle@oel11g ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 5 21:28:11 2012

 

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

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name from v$dbfile;

 

NAME

--------------------------------------------------------------------------------

/u01/app/oracle/oradata/oracle11g/users01.dbf

/u01/app/oracle/oradata/oracle11g/undotbs01.dbf

/u01/app/oracle/oradata/oracle11g/sysaux01.dbf

/u01/app/oracle/oradata/oracle11g/system01.dbf

/u01/app/oracle/oradata/oracle11g/example01.dbf

 

只有答案B,C是数据丢失或损坏的选项,所以选择B,C


                                                                                                    Thanks

                                                                                                      Onepiece

                                                                                                       2012-09-22

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

下一篇: 11gOCP精解 之 02
请登录后发表评论 登录
全部评论

注册时间:2012-07-07

最新文章