DRA: data recovery advisor ,数据恢复顾问,可主动和被动分析故障
制造故障
mv users01.dbf users01.dbf.bak
检测
SQL> alter system checkpoint; alter system checkpoint * ERROR at line 1: ORA-03113: end-of-file on communication channel Process ID: 130432 Session ID: 21 Serial number: 38991
发现数据崩溃了,尝试打开数据库
SQL> startup; ORACLE instance started. Total System Global Area 4999610368 bytes Fixed Size 8803024 bytes Variable Size 1040190768 bytes Database Buffers 3942645760 bytes Redo Buffers 7970816 bytes Database mounted. ORA-01157: cannot identify/lock data file 7 - see DBWR trace file ORA-01110: data file 7: '/oracle/lu8db/oradata/lu8db/users01.dbf'
RMAN 尝试DRA
[oralu8@mylu8 lu8db]$ rman target / Recovery Manager: Release 12.2.0.1.0 - Production on Fri Jun 19 20:52:08 2020 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. connected to target database: LU8DB (DBID=601284688, not open) RMAN> list failure detail; using target database control file instead of recovery catalog Database Role: PRIMARY List of Database Failures ========================= Failure ID Priority Status Time Detected Summary ---------- -------- --------- ------------------- ------- 942 HIGH OPEN 2020-06-19 19:10:25 One or more non-system datafiles are missing Impact: See impact for individual child failures List of child failures for parent failure ID 942 Failure ID Priority Status Time Detected Summary ---------- -------- --------- ------------------- ------- 1150 HIGH OPEN 2020-06-19 20:48:12 Datafile 7: '/oracle/lu8db/oradata/lu8db/users01.dbf' is missing Impact: Some objects in tablespace USERS might be unavailable RMAN> advise failure 1150 ; Database Role: PRIMARY List of Database Failures ========================= Failure ID Priority Status Time Detected Summary ---------- -------- --------- ------------------- ------- 1150 HIGH OPEN 2020-06-19 20:48:12 Datafile 7: '/oracle/lu8db/oradata/lu8db/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=12 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=138 device type=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: SID=263 device type=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: SID=390 device type=DISK analyzing automatic repair options complete Mandatory Manual Actions ======================== no manual actions available Optional Manual Actions ======================= 1. If file /oracle/lu8db/oradata/lu8db/users01.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: /oracle/lu8db/diag/rdbms/lu8db/lu8db/hm/reco_742794723.hm
尝试自动修复
RMAN> @/oracle/lu8db/diag/rdbms/lu8db/lu8db/hm/reco_742794723.hm RMAN> # restore and recover datafile 2> restore ( datafile 7 ); Starting restore at 2020-06-19 20:53:22 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 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 /oracle/lu8db/oradata/lu8db/users01.dbf channel ORA_DISK_1: reading from backup piece /oracle/lu8db/12c/dbs/0pv35bqb_1_1 channel ORA_DISK_1: piece handle=/oracle/lu8db/12c/dbs/0pv35bqb_1_1 tag=TAG20200619T153746 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 2020-06-19 20:53:23 RMAN> recover datafile 7; Starting recover at 2020-06-19 20:53:23 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 starting media recovery archived log for thread 1 with sequence 4 is already on disk as file /oracle/lu8db/12c/dbs/arch1_4_1043341011.dbf archived log file name=/oracle/lu8db/12c/dbs/arch1_4_1043341011.dbf thread=1 sequence=4 media recovery complete, elapsed time: 00:00:00 Finished recover at 2020-06-19 20:53:23 RMAN> sql 'alter database datafile 7 online'; sql statement: alter database datafile 7 online RMAN> **end-of-file**
确认结果
QL> alter database open; Database altered. SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 ZTZPDB READ WRITE NO 4 ZTZ3 READ WRITE NO 6 ZTZ2 READ WRITE NO
故障清除了
RMAN> list failure detail; Database Role: PRIMARY no failures found that match specification
总结,DRA,比较智能但是,还是要人的参与.