RMAN 备份与恢复之所有文件都丢失

实验环境

  • 操作系统 Redhat5.4 x86
  • 数据库版本 oracle 11gR2 (11.2.0.1.0)
  • 实验前已经做了RMAN全量备份包括controlfile、spfile

实验模拟

所有文件都丢失

数据库所有文件都丢失(spfile,controlfile,undofile,tempfile,redo logs等)
数据库rman备份存在情况下的数据库恢复。

案例模拟

手动将spfile文件以及oradata目录下PROD库的所有数据文件删除(PROD目录下有disk1-disk5五个目录,模拟五个磁盘分区):

[oracle@node1 oradata]$ cd PROD
[oracle@node1 PROD]$ ls
disk1  disk2  disk3  disk4  disk5
[oracle@node1 PROD]$ rm -rf *
[oracle@node1 PROD]$ ls

[oracle@node1 PROD]$ cd $ORACLE_HOME/dbs
[oracle@node1 dbs]$ ls
bak_initPROD.ora  hc_PROD1.dat  initPROD1.ora  lkPROD     orapwPROD      peshm_DUMMY_0  peshm_PROD1_0   spfileorcl.ora
hc_DBUA0.dat      hc_PROD.dat   lkDUMMY        lkPROD1    orapwPROD1     peshm_orcl_0   snapcf_PROD1.f  spfilePROD1.ora
hc_orcl.dat       init.ora      lkORCL         orapworcl  peshm_DBUA0_0  peshm_PROD_0   snapcf_PROD.f   spfilePROD.ora
[oracle@node1 dbs]$ rm spfilePROD.ora 

案例模拟


[oracle@node1 2017_05_10]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Wed May 10 21:25:07 2017

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

connected to target database (not started)

RMAN> restore spfile from '/u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkp';

Starting restore at 10-MAY-17
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/10/2017 21:25:31
RMAN-12010: automatic channel allocation initialization failed
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory

手动启动数据库:

RMAN> startup;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initPROD.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 05/10/2017 21:25:55
ORA-00205: error in identifying control file, check alert log for more info

尝试restore spfile from autobackup

RMAN> restore spfile from autobackup;

Starting restore at 10-MAY-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=22 device type=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/10/2017 21:26:33
RMAN-06495: must explicitly specify DBID with SET DBID command

由于controlfile文件也丢失了,无法获取到自动备份信息,因此恢复失败,下面从指定的自动备份文件进行恢复:

RMAN> restore spfile from '/u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkp';

Starting restore at 10-MAY-17
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 10-MAY-17

spfile文件恢复成功,然后进行controlfile恢复:

RMAN> restore controlfile from autobackup;

Starting restore at 10-MAY-17
using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/10/2017 21:28:22
RMAN-06495: must explicitly specify DBID with SET DBID command

提示需要先设置DBID,具体DBID获取方法参照其他大神们总结文档:
http://blog.csdn.net/haibusuanyun/article/details/16370885

本文直接通过查看自动备份文件名获取到dbid值,例如:

[oracle@node1 2017_05_10]$ ls
o1_mf_s_943650940_dk64mxbf_.bkp

从上面的文件名中可以获取到DBID为:943650940
因此,继续设置DBID值以后继续进行恢复controfile文件:

RMAN> set dbid=943650940;

executing command: SET DBID

RMAN> restore controlfile from autobackup;

Starting restore at 10-MAY-17
using channel ORA_DISK_1

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170510
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170509
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170508
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170507
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170506
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170505
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170504
channel ORA_DISK_1: no AUTOBACKUP in 7 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/10/2017 22:02:23
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

同样由于控制文件丢失导致找不到自动备份信息,需要手动指定备份文件路径:

RMAN> restore controlfile from '/u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkp';

Starting restore at 10-MAY-17
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/cntrlPROD.dbf
Finished restore at 10-MAY-17

控制文件虽然恢复出来了,但是路径,名字以及个数都不对,
突然想到恢复完spfile文件以后,没有重启数据库,
因此,当前数据库使用的不是恢复出来的spfile文件,
导致恢复出来的controlfile文件使用了默认目录以及名字。
重启数据库从spfile文件启动,并重新恢复controlfile文件:

[oracle@node1 2017_05_10]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed May 10 22:05:15 2017

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> show parameter spfile;

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
spfile                   string
SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area  836976640 bytes
Fixed Size          1339740 bytes
Variable Size         683675300 bytes
Database Buffers      146800640 bytes
Redo Buffers            5160960 bytes
ORA-00205: error in identifying control file, check alert log for more info


SQL> show parameter spfile;

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
spfile                   string  /u01/app/oracle/product/11.2.0
                         /dbhome_1/dbs/spfilePROD.ora
SQL> show parameter control

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                string  /u01/app/oracle/oradata/PROD/d
                         isk2/control1, /u01/app/oracle
                         /oradata/PROD/disk2/control2,
                         /u01/app/oracle/oradata/PROD/d
                         isk2/control3
control_management_pack_access       string  DIAGNOSTIC+TUNING
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@node1 PROD]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Wed May 10 22:06:35 2017

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

connected to target database: PROD (not mounted)

RMAN> restore controlfile from autobackup;

Starting restore at 10-MAY-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

recovery area destination: /u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: PROD
channel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkp found in the recovery area
AUTOBACKUP search with format "%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkp
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/10/2017 22:06:47
ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk2/control1"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

有提示报错,提示文件或目录不存在,检查发现disk2目录当时也被删除了,
因此,需要手动创建丢失的目录:

[oracle@node1 oradata]$ cd PROD
[oracle@node1 PROD]$ ls
[oracle@node1 PROD]$ mkdir disk2
[oracle@node1 PROD]$ ls
disk2

目录创建完以后,重新进行恢复controlfile:

RMAN> restore controlfile from autobackup;

Starting restore at 10-MAY-17
using channel ORA_DISK_1

recovery area destination: /u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: PROD
channel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkp found in the recovery area
AUTOBACKUP search with format "%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkp
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/u01/app/oracle/oradata/PROD/disk2/control1
output file name=/u01/app/oracle/oradata/PROD/disk2/control2
output file name=/u01/app/oracle/oradata/PROD/disk2/control3
Finished restore at 10-MAY-17

控制文件恢复完成,继续将数据库启动到mount状态,并进行恢复数据库:

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> restore database;

Starting restore at 10-MAY-17
Starting implicit crosscheck backup at 10-MAY-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
Crosschecked 57 objects
Finished implicit crosscheck backup at 10-MAY-17

Starting implicit crosscheck copy at 10-MAY-17
using channel ORA_DISK_1
Finished implicit crosscheck copy at 10-MAY-17

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_05/o1_mf_s_943223985_djs3olf9_.bkp
File Name: /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkp

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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

failover to previous backup

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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T215306_djy9p2kb_.bkp
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T215306_djy9p2kb_.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

failover to previous backup

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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T210642_djy6z2tt_.bkp
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T210642_djy6z2tt_.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

failover to previous backup

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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T205559_djy6c06t_.bkp
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T205559_djy6c06t_.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

failover to previous backup

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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T185932_djxzjnfp_.bkp
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T185932_djxzjnfp_.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

failover to previous backup

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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T112701_djx50646_.bkp
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T112701_djx50646_.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

failover to previous backup

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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T103654_djx226vw_.bkp
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T103654_djx226vw_.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

failover to previous backup

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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T092919_djwy3hcj_.bkp
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T092919_djwy3hcj_.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

failover to previous backup

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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_06/o1_mf_nnndf_TAG20170506T074807_djt3sqqq_.bkp
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_06/o1_mf_nnndf_TAG20170506T074807_djt3sqqq_.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

failover to previous backup

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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_06/o1_mf_nnndf_TAG20170506T072607_djt2jj5l_.bkp
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_06/o1_mf_nnndf_TAG20170506T072607_djt2jj5l_.bkp
ORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

failover to previous backup

creating datafile file number=1 name=/u01/app/oracle/oradata/PROD/disk5/system01.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/10/2017 22:08:43
ORA-01180: can not create datafile 1
ORA-01110: data file 1: '/u01/app/oracle/oradata/PROD/disk5/system01.dbf'

restore database报错,根据报错信息发现缺少对应的文件目录:disk1,disk4,disk5手动创建后重新进行恢复数据库:

[oracle@node1 PROD]$ mkdir disk{1,4,5}
[oracle@node1 PROD]$ ls
disk1  disk2  disk4  disk5

RMAN> restore database;

Starting restore at 10-MAY-17
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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp tag=TAG20170510T211443
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:55
Finished restore at 10-MAY-17

RMAN> recover database;

Starting recover at 10-MAY-17
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=4
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkp tag=TAG20170510T211539
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2017_05_10/o1_mf_1_4_dk67vn64_.arc thread=1 sequence=4
channel default: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2017_05_10/o1_mf_1_4_dk67vn64_.arc RECID=81 STAMP=943654260
unable to find archived log
archived log thread=1 sequence=5
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 05/10/2017 22:11:01
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 5 and starting SCN of 800253

recover database失败,提示缺失归档日志,采用不完全恢复:

RMAN> list failure;

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

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
4044       CRITICAL OPEN      10-MAY-17     Control file needs media recovery

RMAN> advise failure;

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

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
4044       CRITICAL OPEN      10-MAY-17     Control file needs media recovery

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 you have the correct version of the control file, then shutdown the database and replace the old control file

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Perform incomplete database recovery  
  Strategy: The repair includes point-in-time recovery with some data loss
  Repair script: /u01/app/oracle/diag/rdbms/prod/PROD/hm/reco_924090238.hm

RMAN> repair failure;

Strategy: The repair includes point-in-time recovery with some data loss
Repair script: /u01/app/oracle/diag/rdbms/prod/PROD/hm/reco_924090238.hm

contents of repair script:
   # database point-in-time recovery until a missing log
   restore database until scn 800253;
   recover database until scn 800253;
   alter database open resetlogs;

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

Starting restore at 10-MAY-17
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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp tag=TAG20170510T211443
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:47
Finished restore at 10-MAY-17

Starting recover at 10-MAY-17
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=4
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkp tag=TAG20170510T211539
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2017_05_10/o1_mf_1_4_dk67zoqb_.arc thread=1 sequence=4
channel default: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2017_05_10/o1_mf_1_4_dk67zoqb_.arc RECID=82 STAMP=943654389
media recovery complete, elapsed time: 00:00:01
Finished recover at 10-MAY-17

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of repair command at 05/10/2017 22:13:23
RMAN-03015: error occurred in stored script Repair Script
ORA-00344: unable to re-create online log '/u01/app/oracle/oradata/PROD/disk3/disk2b.log'
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory

又报错,根据错误信息发现缺失disk3目录,手动创建以后重新进行恢复:

[oracle@node1 PROD]$ mkdir /u01/app/oracle/oradata/PROD/disk3
[oracle@node1 PROD]$ ls
disk1  disk2  disk3  disk4  disk5

RMAN> repair failure;

Strategy: The repair includes point-in-time recovery with some data loss
Repair script: /u01/app/oracle/diag/rdbms/prod/PROD/hm/reco_924090238.hm

contents of repair script:
   # database point-in-time recovery until a missing log
   restore database until scn 800253;
   recover database until scn 800253;
   alter database open resetlogs;

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

Starting restore at 10-MAY-17
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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp tag=TAG20170510T211443
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:46
Finished restore at 10-MAY-17

Starting recover at 10-MAY-17
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of repair command at 05/10/2017 22:15:31
RMAN-03015: error occurred in stored script Repair Script
ORA-19620: /u01/app/oracle/oradata/PROD/disk1/disk1a.log is not of archived log type

再次执行不完全恢复:

RMAN> list failure;

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

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
4132       CRITICAL OPEN      10-MAY-17     System datafile 1: '/u01/app/oracle/oradata/PROD/disk5/system01.dbf' needs media recovery
4044       CRITICAL OPEN      10-MAY-17     Control file needs media recovery
1142       HIGH     OPEN      10-MAY-17     One or more non-system datafiles need media recovery

RMAN> advise failure;

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

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
4132       CRITICAL OPEN      10-MAY-17     System datafile 1: '/u01/app/oracle/oradata/PROD/disk5/system01.dbf' needs media recovery
4044       CRITICAL OPEN      10-MAY-17     Control file needs media recovery
1142       HIGH     OPEN      10-MAY-17     One or more non-system datafiles need media recovery

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 you have the correct version of the control file, then shutdown the database and replace the old control file
2. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/system01.dbf, then replace it with the correct one
3. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf, then replace it with the correct one
4. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf, then replace it with the correct one
5. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk2/users01.dbf, then replace it with the correct one
6. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/example_01.dbf, then replace it with the correct one
7. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf, then replace it with the correct one
8. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/test, then replace it with the correct one
9. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/free_list, then replace it with the correct one
10. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk2/users_01.dbf, then replace it with the correct one

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Perform incomplete database recovery  
  Strategy: The repair includes point-in-time recovery with some data loss
  Repair script: /u01/app/oracle/diag/rdbms/prod/PROD/hm/reco_311059103.hm

RMAN> repair failure;

Strategy: The repair includes point-in-time recovery with some data loss
Repair script: /u01/app/oracle/diag/rdbms/prod/PROD/hm/reco_311059103.hm

contents of repair script:
   # database point-in-time recovery until a missing log
   restore database until scn 800253;
   recover database until scn 800253;
   alter database open resetlogs;

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

Starting restore at 10-MAY-17
using channel ORA_DISK_1

skipping datafile 1; already restored to file /u01/app/oracle/oradata/PROD/disk5/system01.dbf
skipping datafile 2; already restored to file /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
skipping datafile 3; already restored to file /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
skipping datafile 4; already restored to file /u01/app/oracle/oradata/PROD/disk2/users01.dbf
skipping datafile 5; already restored to file /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
skipping datafile 6; already restored to file /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
skipping datafile 8; already restored to file /u01/app/oracle/oradata/PROD/disk5/test
skipping datafile 9; already restored to file /u01/app/oracle/oradata/PROD/disk1/free_list
skipping datafile 10; already restored to file /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
restore not done; all files read only, offline, or already restored
Finished restore at 10-MAY-17

Starting recover at 10-MAY-17
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of repair command at 05/10/2017 22:16:17
RMAN-03015: error occurred in stored script Repair Script
ORA-19620: /u01/app/oracle/oradata/PROD/disk1/disk1a.log is not of archived log type

经过多次尝试,提示以上信息数据文件已经restored,手动以resetlogs方式打开数据库同样失败.
最后将各个disk下的文件全部删除,重新进行restore和recover数据库:

[oracle@node1 PROD]$ ls
disk1  disk2  disk3  disk4  disk5
[oracle@node1 PROD]$ cd disk1
[oracle@node1 disk1]$ ls
disk1a.log  exam_01.dbf  free_list  sysaux01.dbf
[oracle@node1 disk1]$ rm *
[oracle@node1 disk1]$ ls
[oracle@node1 disk1]$ cd ..
[oracle@node1 PROD]$ ls
disk1  disk2  disk3  disk4  disk5
[oracle@node1 PROD]$ cd disk2
[oracle@node1 disk2]$ ls
control1  control2  control3  disk1b.log  disk2a.log  users_01.dbf  users01.dbf
[oracle@node1 disk2]$ rm *.log
[oracle@node1 disk2]$ rm *.dbf
[oracle@node1 disk2]$ ls
control1  control2  control3
[oracle@node1 disk2]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed May 10 22:23:02 2017

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> shutdown abort;
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@node1 disk2]$ ls
control1  control2  control3
[oracle@node1 disk2]$ cd ..
[oracle@node1 PROD]$ ls
disk1  disk2  disk3  disk4  disk5
[oracle@node1 PROD]$ cd disk4
[oracle@node1 disk4]$ ls
undotbs01.dbf
[oracle@node1 disk4]$ rm *
[oracle@node1 disk4]$ ls
[oracle@node1 disk4]$ cd ..
[oracle@node1 PROD]$ ls
disk1  disk2  disk3  disk4  disk5
[oracle@node1 PROD]$ cd disk5
[oracle@node1 disk5]$ ls
example_01.dbf  system01.dbf  test
[oracle@node1 disk5]$ rm *
[oracle@node1 disk5]$ ls
[oracle@node1 disk5]$ cd ..
[oracle@node1 PROD]$ ls
disk1  disk2  disk3  disk4  disk5
[oracle@node1 PROD]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Wed May 10 22:23:35 2017

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

connected to target database (not started)

RMAN> startup;

Oracle instance started
database mounted
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 05/10/2017 22:23:46
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> list failure;

using target database control file instead of recovery catalog
List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
4441       CRITICAL OPEN      10-MAY-17     System datafile 1: '/u01/app/oracle/oradata/PROD/disk5/system01.dbf' is missing
4132       CRITICAL OPEN      10-MAY-17     System datafile 1: '/u01/app/oracle/oradata/PROD/disk5/system01.dbf' needs media recovery
4044       CRITICAL OPEN      10-MAY-17     Control file needs media recovery
1479       HIGH     OPEN      10-MAY-17     One or more non-system datafiles are missing
1142       HIGH     OPEN      10-MAY-17     One or more non-system datafiles need media recovery

RMAN> advise failure;

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

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
4441       CRITICAL OPEN      10-MAY-17     System datafile 1: '/u01/app/oracle/oradata/PROD/disk5/system01.dbf' is missing
4132       CRITICAL OPEN      10-MAY-17     System datafile 1: '/u01/app/oracle/oradata/PROD/disk5/system01.dbf' needs media recovery
4044       CRITICAL OPEN      10-MAY-17     Control file needs media recovery
1479       HIGH     OPEN      10-MAY-17     One or more non-system datafiles are missing
1142       HIGH     OPEN      10-MAY-17     One or more non-system datafiles need media recovery

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

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

Optional Manual Actions
=======================
1. If you have the correct version of the control file, then shutdown the database and replace the old control file
2. If file /u01/app/oracle/oradata/PROD/disk5/system01.dbf was unintentionally renamed or moved, restore it
3. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/system01.dbf, then replace it with the correct one
4. If file /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf was unintentionally renamed or moved, restore it
5. If file /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf was unintentionally renamed or moved, restore it
6. If file /u01/app/oracle/oradata/PROD/disk2/users01.dbf was unintentionally renamed or moved, restore it
7. If file /u01/app/oracle/oradata/PROD/disk5/example_01.dbf was unintentionally renamed or moved, restore it
8. If file /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf was unintentionally renamed or moved, restore it
9. If file /u01/app/oracle/oradata/PROD/disk5/test was unintentionally renamed or moved, restore it
10. If file /u01/app/oracle/oradata/PROD/disk1/free_list was unintentionally renamed or moved, restore it
11. If file /u01/app/oracle/oradata/PROD/disk2/users_01.dbf was unintentionally renamed or moved, restore it
12. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf, then replace it with the correct one
13. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf, then replace it with the correct one
14. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk2/users01.dbf, then replace it with the correct one
15. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/example_01.dbf, then replace it with the correct one
16. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf, then replace it with the correct one
17. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/test, then replace it with the correct one
18. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/free_list, then replace it with the correct one
19. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk2/users_01.dbf, then replace it with the correct one

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Perform incomplete database recovery  
  Strategy: The repair includes point-in-time recovery with some data loss
  Repair script: /u01/app/oracle/diag/rdbms/prod/PROD/hm/reco_2383861944.hm

RMAN> repair failure;

Strategy: The repair includes point-in-time recovery with some data loss
Repair script: /u01/app/oracle/diag/rdbms/prod/PROD/hm/reco_2383861944.hm

contents of repair script:
   # database point-in-time recovery until a missing log
   restore database until scn 800253;
   recover database until scn 800253;
   alter database open resetlogs;

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

Starting restore at 10-MAY-17
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/PROD/disk5/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/test
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_list
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp tag=TAG20170510T211443
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 10-MAY-17

Starting recover at 10-MAY-17
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=4
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkp tag=TAG20170510T211539
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2017_05_10/o1_mf_1_4_dk68p08s_.arc thread=1 sequence=4
channel default: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2017_05_10/o1_mf_1_4_dk68p08s_.arc RECID=83 STAMP=943655104
media recovery complete, elapsed time: 00:00:00
Finished recover at 10-MAY-17

database opened
repair failure complete

RMAN> exit


Recovery Manager complete.
[oracle@node1 PROD]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed May 10 22:26:08 2017

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 open_mode, log_mode from v$database;

OPEN_MODE        LOG_MODE
-------------------- ------------
READ WRITE       ARCHIVELOG

至此,数据库已经完全恢复,最然中间遇到了不少问题。
在restore database以及recover database过程中报错是因为对应的文件目录缺失导致,只要将对应缺失的目录重新创建出来后,重新进行回复就即可。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值