前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >DRA(Data Recovery Advisor)的使用

DRA(Data Recovery Advisor)的使用

作者头像
Alfred Zhao
发布2019-05-24 20:37:31
8200
发布2019-05-24 20:37:31
举报

关于DRA的官方描述:

The simplest way to diagnose and repair database problems is to use the Data Recovery Advisor. This Oracle Database tool provides an infrastructure for diagnosing persistent data failures, presenting repair options to the user, and automatically executing repairs.

下面我们来做一个小实验来实际体会下DRA的便利性:

  1. rman登录到目标数据库
  2. 我们这里模拟丢失了一个数据文件
  3. 观察DRA是如何恢复数据库的

1.rman登录到目标数据库

[oracle@JY-DB BACKUP]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 5 11:15:12 2015

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

connected to target database: JYZHAO (DBID=2463175424, not open)

RMAN> LIST FAILURE;

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

可以看到目前数据库没有找到需要恢复的匹配项。

2.我们这里模拟丢失了一个数据文件

#2.1 正常关库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

#2.2 删除数据文件+DATA1/jyzhao/datafile/dbs_d_jingyu.259.886871319
#直接删除数据文件会报错
ASMCMD> rm  DBS_D_JINGYU.259.886871319
ORA-15032: not all alterations performed
ORA-15028: ASM file '+DATA1/jyzhao/datafile/DBS_D_JINGYU.259.886871319' not dropped; currently being accessed (DBD ERROR: OCIStmtExecute)
#数据库关闭后删除成功
ASMCMD>  rm  DBS_D_JINGYU.259.886871319
ASMCMD>

#2.3 尝试打开数据库报错
SQL> startup
ORACLE instance started.

Total System Global Area 1620115456 bytes
Fixed Size                  2253704 bytes
Variable Size             905972856 bytes
Database Buffers          704643072 bytes
Redo Buffers                7245824 bytes
Database mounted.


ORA-01157: cannot identify/lock data file 15 - see DBWR trace file
ORA-01110: data file 15: '+DATA1/jyzhao/datafile/dbs_d_jingyu.259.886871319'

3.观察DRA是如何恢复数据库的

3.1 LIST FAILURE;

RMAN> LIST FAILURE;

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

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
4042       HIGH     OPEN      05-AUG-15     One or more non-system datafiles are missing

3.2 ADVISE FAILURE;

RMAN> ADVISE FAILURE;

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

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
4042       HIGH     OPEN      05-AUG-15     One or more non-system datafiles are missing

analyzing automatic repair options; this may take some time
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=25 device type=DISK
analyzing automatic repair options complete

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

Optional Manual Actions
=======================
1. If file +DATA1/jyzhao/datafile/dbs_d_jingyu.259.886871319 was unintentionally renamed or moved, restore it
2. Try flush redo using ALTER SYSTEM FLUSH REDO TO 'standby name' command.  Then perform a Data Guard role change (failover).  Available standbys: jyzhao_s.

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

3.3 REPAIR FAILURE;

RMAN>  REPAIR FAILURE;

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

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

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

Starting restore at 05-AUG-15
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 00015 to +DATA1/jyzhao/datafile/dbs_d_jingyu.259.886871319
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/db_1/dbs/arch/JYZHAO/backupset/2015_08_05/o1_mf_nnndf_TAG20150805T102730_bw2x4m1l_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/db_1/dbs/arch/JYZHAO/backupset/2015_08_05/o1_mf_nnndf_TAG20150805T102730_bw2x4m1l_.bkp tag=TAG20150805T102730
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 05-AUG-15

Starting recover at 05-AUG-15
using channel ORA_DISK_1

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

Finished recover at 05-AUG-15

sql statement: alter database datafile 15 online
repair failure complete

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

RMAN> 

到此,使用DRA自动恢复完毕并成功打开数据库。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2015-08-05 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1.rman登录到目标数据库
  • 2.我们这里模拟丢失了一个数据文件
  • 3.观察DRA是如何恢复数据库的
    • 3.1 LIST FAILURE;
      • 3.2 ADVISE FAILURE;
        • 3.3 REPAIR FAILURE;
        相关产品与服务
        数据库
        云数据库为企业提供了完善的关系型数据库、非关系型数据库、分析型数据库和数据库生态工具。您可以通过产品选择和组合搭建,轻松实现高可靠、高可用性、高性能等数据库需求。云数据库服务也可大幅减少您的运维工作量,更专注于业务发展,让企业一站式享受数据上云及分布式架构的技术红利!
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档