RMAN 备份与恢复之所有文件都丢失
来源:互联网 发布:园林景观设计制图软件 编辑:程序博客网 时间:2024/05/18 20:12
实验环境
- 操作系统 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]$ lsdisk1 disk2 disk3 disk4 disk5[oracle@node1 PROD]$ rm -rf *[oracle@node1 PROD]$ ls[oracle@node1 PROD]$ cd $ORACLE_HOME/dbs[oracle@node1 dbs]$ lsbak_initPROD.ora hc_PROD1.dat initPROD1.ora lkPROD orapwPROD peshm_DUMMY_0 peshm_PROD1_0 spfileorcl.orahc_DBUA0.dat hc_PROD.dat lkDUMMY lkPROD1 orapwPROD1 peshm_orcl_0 snapcf_PROD1.f spfilePROD1.orahc_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 2017Copyright (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-17using target database control file instead of recovery catalogRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of restore command at 05/10/2017 21:25:31RMAN-12010: automatic channel allocation initialization failedRMAN-06403: could not obtain a fully authorized sessionORA-01034: ORACLE not availableORA-27101: shared memory realm does not existLinux Error: 2: No such file or directory
手动启动数据库:
RMAN> startup;startup failed: ORA-01078: failure in processing system parametersLRM-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 spfileOracle instance startedRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of startup command at 05/10/2017 21:25:55ORA-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-17allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=22 device type=DISKRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of restore command at 05/10/2017 21:26:33RMAN-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-17using channel ORA_DISK_1channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkpchannel ORA_DISK_1: SPFILE restore from AUTOBACKUP completeFinished restore at 10-MAY-17
spfile文件恢复成功,然后进行controlfile恢复:
RMAN> restore controlfile from autobackup;Starting restore at 10-MAY-17using channel ORA_DISK_1RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of restore command at 05/10/2017 21:28:22RMAN-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]$ lso1_mf_s_943650940_dk64mxbf_.bkp
从上面的文件名中可以获取到DBID为:943650940
因此,继续设置DBID值以后继续进行恢复controfile文件:
RMAN> set dbid=943650940;executing command: SET DBIDRMAN> restore controlfile from autobackup;Starting restore at 10-MAY-17using channel ORA_DISK_1channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170510channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170509channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170508channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170507channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170506channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170505channel ORA_DISK_1: looking for AUTOBACKUP on day: 20170504channel ORA_DISK_1: no AUTOBACKUP in 7 days foundRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of restore command at 05/10/2017 22:02:23RMAN-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-17using channel ORA_DISK_1channel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete, elapsed time: 00:00:01output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/cntrlPROD.dbfFinished restore at 10-MAY-17
控制文件虽然恢复出来了,但是路径,名字以及个数都不对,
突然想到恢复完spfile文件以后,没有重启数据库,
因此,当前数据库使用的不是恢复出来的spfile文件,
导致恢复出来的controlfile文件使用了默认目录以及名字。
重启数据库从spfile文件启动,并重新恢复controlfile文件:
[oracle@node1 2017_05_10]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Wed May 10 22:05:15 2017Copyright (c) 1982, 2009, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> show parameter spfile;NAME TYPE VALUE------------------------------------ ----------- ------------------------------spfile stringSQL> shutdown immediate;ORA-01507: database not mountedORACLE instance shut down.SQL> startup;ORACLE instance started.Total System Global Area 836976640 bytesFixed Size 1339740 bytesVariable Size 683675300 bytesDatabase Buffers 146800640 bytesRedo Buffers 5160960 bytesORA-00205: error in identifying control file, check alert log for more infoSQL> show parameter spfile;NAME TYPE VALUE------------------------------------ ----------- ------------------------------spfile string /u01/app/oracle/product/11.2.0 /dbhome_1/dbs/spfilePROD.oraSQL> show parameter controlNAME TYPE VALUE------------------------------------ ----------- ------------------------------control_file_record_keep_time integer 7control_files string /u01/app/oracle/oradata/PROD/d isk2/control1, /u01/app/oracle /oradata/PROD/disk2/control2, /u01/app/oracle/oradata/PROD/d isk2/control3control_management_pack_access string DIAGNOSTIC+TUNINGSQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith 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 2017Copyright (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-17using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=20 device type=DISKrecovery area destination: /u01/app/oracle/flash_recovery_areadatabase name (or database unique name) used for search: PRODchannel 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 areaAUTOBACKUP search with format "%F" not attempted because DBID was not setchannel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkpRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of restore command at 05/10/2017 22:06:47ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkpORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk2/control1"ORA-27040: file create error, unable to create fileLinux 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]$ lsdisk2
目录创建完以后,重新进行恢复controlfile:
RMAN> restore controlfile from autobackup;Starting restore at 10-MAY-17using channel ORA_DISK_1recovery area destination: /u01/app/oracle/flash_recovery_areadatabase name (or database unique name) used for search: PRODchannel 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 areaAUTOBACKUP search with format "%F" not attempted because DBID was not setchannel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkpchannel ORA_DISK_1: control file restore from AUTOBACKUP completeoutput file name=/u01/app/oracle/oradata/PROD/disk2/control1output file name=/u01/app/oracle/oradata/PROD/disk2/control2output file name=/u01/app/oracle/oradata/PROD/disk2/control3Finished restore at 10-MAY-17
控制文件恢复完成,继续将数据库启动到mount状态,并进行恢复数据库:
RMAN> alter database mount;database mountedreleased channel: ORA_DISK_1RMAN> restore database;Starting restore at 10-MAY-17Starting implicit crosscheck backup at 10-MAY-17allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=20 device type=DISKCrosschecked 57 objectsFinished implicit crosscheck backup at 10-MAY-17Starting implicit crosscheck copy at 10-MAY-17using channel ORA_DISK_1Finished implicit crosscheck copy at 10-MAY-17searching for all files in the recovery areacataloging files...cataloging doneList of Cataloged Files=======================File Name: /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_05/o1_mf_s_943223985_djs3olf9_.bkpFile Name: /u01/app/oracle/flash_recovery_area/PROD/autobackup/2017_05_10/o1_mf_s_943650940_dk64mxbf_.bkpusing channel ORA_DISK_1channel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkpchannel 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_.bkpORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"ORA-27040: file create error, unable to create fileLinux Error: 2: No such file or directoryfailover to previous backupchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T215306_djy9p2kb_.bkpchannel 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_.bkpORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"ORA-27040: file create error, unable to create fileLinux Error: 2: No such file or directoryfailover to previous backupchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T210642_djy6z2tt_.bkpchannel 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_.bkpORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"ORA-27040: file create error, unable to create fileLinux Error: 2: No such file or directoryfailover to previous backupchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T205559_djy6c06t_.bkpchannel 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_.bkpORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"ORA-27040: file create error, unable to create fileLinux Error: 2: No such file or directoryfailover to previous backupchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T185932_djxzjnfp_.bkpchannel 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_.bkpORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"ORA-27040: file create error, unable to create fileLinux Error: 2: No such file or directoryfailover to previous backupchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T112701_djx50646_.bkpchannel 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_.bkpORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"ORA-27040: file create error, unable to create fileLinux Error: 2: No such file or directoryfailover to previous backupchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T103654_djx226vw_.bkpchannel 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_.bkpORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"ORA-27040: file create error, unable to create fileLinux Error: 2: No such file or directoryfailover to previous backupchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_07/o1_mf_nnndf_TAG20170507T092919_djwy3hcj_.bkpchannel 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_.bkpORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"ORA-27040: file create error, unable to create fileLinux Error: 2: No such file or directoryfailover to previous backupchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_06/o1_mf_nnndf_TAG20170506T074807_djt3sqqq_.bkpchannel 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_.bkpORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"ORA-27040: file create error, unable to create fileLinux Error: 2: No such file or directoryfailover to previous backupchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_06/o1_mf_nnndf_TAG20170506T072607_djt2jj5l_.bkpchannel 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_.bkpORA-19504: failed to create file "/u01/app/oracle/oradata/PROD/disk5/system01.dbf"ORA-27040: file create error, unable to create fileLinux Error: 2: No such file or directoryfailover to previous backupcreating datafile file number=1 name=/u01/app/oracle/oradata/PROD/disk5/system01.dbfRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of restore command at 05/10/2017 22:08:43ORA-01180: can not create datafile 1ORA-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]$ lsdisk1 disk2 disk4 disk5RMAN> restore database;Starting restore at 10-MAY-17using channel ORA_DISK_1channel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkpchannel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp tag=TAG20170510T211443channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:55Finished restore at 10-MAY-17RMAN> recover database;Starting recover at 10-MAY-17using channel ORA_DISK_1starting media recoverychannel ORA_DISK_1: starting archived log restore to default destinationchannel ORA_DISK_1: restoring archived logarchived log thread=1 sequence=4channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkpchannel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkp tag=TAG20170510T211539channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01archived log file name=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2017_05_10/o1_mf_1_4_dk67vn64_.arc thread=1 sequence=4channel 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=943654260unable to find archived logarchived log thread=1 sequence=5RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 05/10/2017 22:11:01RMAN-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 recoveryRMAN> advise failure;List of Database Failures=========================Failure ID Priority Status Time Detected Summary---------- -------- --------- ------------- -------4044 CRITICAL OPEN 10-MAY-17 Control file needs media recoveryanalyzing automatic repair options; this may take some timeusing channel ORA_DISK_1analyzing automatic repair options completeMandatory Manual Actions========================no manual actions availableOptional Manual Actions=======================1. If you have the correct version of the control file, then shutdown the database and replace the old control fileAutomated 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.hmRMAN> repair failure;Strategy: The repair includes point-in-time recovery with some data lossRepair script: /u01/app/oracle/diag/rdbms/prod/PROD/hm/reco_924090238.hmcontents 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)? yesexecuting repair scriptStarting restore at 10-MAY-17using channel ORA_DISK_1channel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkpchannel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp tag=TAG20170510T211443channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:47Finished restore at 10-MAY-17Starting recover at 10-MAY-17using channel ORA_DISK_1starting media recoverychannel ORA_DISK_1: starting archived log restore to default destinationchannel ORA_DISK_1: restoring archived logarchived log thread=1 sequence=4channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkpchannel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkp tag=TAG20170510T211539channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01archived log file name=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2017_05_10/o1_mf_1_4_dk67zoqb_.arc thread=1 sequence=4channel 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=943654389media recovery complete, elapsed time: 00:00:01Finished recover at 10-MAY-17RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of repair command at 05/10/2017 22:13:23RMAN-03015: error occurred in stored script Repair ScriptORA-00344: unable to re-create online log '/u01/app/oracle/oradata/PROD/disk3/disk2b.log'ORA-27040: file create error, unable to create fileLinux Error: 2: No such file or directory
又报错,根据错误信息发现缺失disk3目录,手动创建以后重新进行恢复:
[oracle@node1 PROD]$ mkdir /u01/app/oracle/oradata/PROD/disk3[oracle@node1 PROD]$ lsdisk1 disk2 disk3 disk4 disk5RMAN> repair failure;Strategy: The repair includes point-in-time recovery with some data lossRepair script: /u01/app/oracle/diag/rdbms/prod/PROD/hm/reco_924090238.hmcontents 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)? yesexecuting repair scriptStarting restore at 10-MAY-17using channel ORA_DISK_1channel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkpchannel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp tag=TAG20170510T211443channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:46Finished restore at 10-MAY-17Starting recover at 10-MAY-17using channel ORA_DISK_1RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of repair command at 05/10/2017 22:15:31RMAN-03015: error occurred in stored script Repair ScriptORA-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 recovery4044 CRITICAL OPEN 10-MAY-17 Control file needs media recovery1142 HIGH OPEN 10-MAY-17 One or more non-system datafiles need media recoveryRMAN> 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 recovery4044 CRITICAL OPEN 10-MAY-17 Control file needs media recovery1142 HIGH OPEN 10-MAY-17 One or more non-system datafiles need media recoveryanalyzing automatic repair options; this may take some timeusing channel ORA_DISK_1analyzing automatic repair options completeMandatory Manual Actions========================no manual actions availableOptional Manual Actions=======================1. If you have the correct version of the control file, then shutdown the database and replace the old control file2. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/system01.dbf, then replace it with the correct one3. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf, then replace it with the correct one4. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf, then replace it with the correct one5. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk2/users01.dbf, then replace it with the correct one6. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/example_01.dbf, then replace it with the correct one7. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf, then replace it with the correct one8. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/test, then replace it with the correct one9. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/free_list, then replace it with the correct one10. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk2/users_01.dbf, then replace it with the correct oneAutomated 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.hmRMAN> repair failure;Strategy: The repair includes point-in-time recovery with some data lossRepair script: /u01/app/oracle/diag/rdbms/prod/PROD/hm/reco_311059103.hmcontents 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)? yesexecuting repair scriptStarting restore at 10-MAY-17using channel ORA_DISK_1skipping datafile 1; already restored to file /u01/app/oracle/oradata/PROD/disk5/system01.dbfskipping datafile 2; already restored to file /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfskipping datafile 3; already restored to file /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfskipping datafile 4; already restored to file /u01/app/oracle/oradata/PROD/disk2/users01.dbfskipping datafile 5; already restored to file /u01/app/oracle/oradata/PROD/disk5/example_01.dbfskipping datafile 6; already restored to file /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfskipping datafile 8; already restored to file /u01/app/oracle/oradata/PROD/disk5/testskipping datafile 9; already restored to file /u01/app/oracle/oradata/PROD/disk1/free_listskipping datafile 10; already restored to file /u01/app/oracle/oradata/PROD/disk2/users_01.dbfrestore not done; all files read only, offline, or already restoredFinished restore at 10-MAY-17Starting recover at 10-MAY-17using channel ORA_DISK_1RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of repair command at 05/10/2017 22:16:17RMAN-03015: error occurred in stored script Repair ScriptORA-19620: /u01/app/oracle/oradata/PROD/disk1/disk1a.log is not of archived log type
经过多次尝试,提示以上信息数据文件已经restored,手动以resetlogs方式打开数据库同样失败.
最后将各个disk下的文件全部删除,重新进行restore和recover数据库:
[oracle@node1 PROD]$ lsdisk1 disk2 disk3 disk4 disk5[oracle@node1 PROD]$ cd disk1[oracle@node1 disk1]$ lsdisk1a.log exam_01.dbf free_list sysaux01.dbf[oracle@node1 disk1]$ rm *[oracle@node1 disk1]$ ls[oracle@node1 disk1]$ cd ..[oracle@node1 PROD]$ lsdisk1 disk2 disk3 disk4 disk5[oracle@node1 PROD]$ cd disk2[oracle@node1 disk2]$ lscontrol1 control2 control3 disk1b.log disk2a.log users_01.dbf users01.dbf[oracle@node1 disk2]$ rm *.log[oracle@node1 disk2]$ rm *.dbf[oracle@node1 disk2]$ lscontrol1 control2 control3[oracle@node1 disk2]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Wed May 10 22:23:02 2017Copyright (c) 1982, 2009, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> shutdown abort;ORACLE instance shut down.SQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options[oracle@node1 disk2]$ lscontrol1 control2 control3[oracle@node1 disk2]$ cd ..[oracle@node1 PROD]$ lsdisk1 disk2 disk3 disk4 disk5[oracle@node1 PROD]$ cd disk4[oracle@node1 disk4]$ lsundotbs01.dbf[oracle@node1 disk4]$ rm *[oracle@node1 disk4]$ ls[oracle@node1 disk4]$ cd ..[oracle@node1 PROD]$ lsdisk1 disk2 disk3 disk4 disk5[oracle@node1 PROD]$ cd disk5[oracle@node1 disk5]$ lsexample_01.dbf system01.dbf test[oracle@node1 disk5]$ rm *[oracle@node1 disk5]$ ls[oracle@node1 disk5]$ cd ..[oracle@node1 PROD]$ lsdisk1 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 2017Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.connected to target database (not started)RMAN> startup;Oracle instance starteddatabase mountedRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of startup command at 05/10/2017 22:23:46ORA-01589: must use RESETLOGS or NORESETLOGS option for database openRMAN> list failure;using target database control file instead of recovery catalogList 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 missing4132 CRITICAL OPEN 10-MAY-17 System datafile 1: '/u01/app/oracle/oradata/PROD/disk5/system01.dbf' needs media recovery4044 CRITICAL OPEN 10-MAY-17 Control file needs media recovery1479 HIGH OPEN 10-MAY-17 One or more non-system datafiles are missing1142 HIGH OPEN 10-MAY-17 One or more non-system datafiles need media recoveryRMAN> 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 missing4132 CRITICAL OPEN 10-MAY-17 System datafile 1: '/u01/app/oracle/oradata/PROD/disk5/system01.dbf' needs media recovery4044 CRITICAL OPEN 10-MAY-17 Control file needs media recovery1479 HIGH OPEN 10-MAY-17 One or more non-system datafiles are missing1142 HIGH OPEN 10-MAY-17 One or more non-system datafiles need media recoveryanalyzing automatic repair options; this may take some timeallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=18 device type=DISKanalyzing automatic repair options completeMandatory Manual Actions========================no manual actions availableOptional Manual Actions=======================1. If you have the correct version of the control file, then shutdown the database and replace the old control file2. If file /u01/app/oracle/oradata/PROD/disk5/system01.dbf was unintentionally renamed or moved, restore it3. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/system01.dbf, then replace it with the correct one4. If file /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf was unintentionally renamed or moved, restore it5. If file /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf was unintentionally renamed or moved, restore it6. If file /u01/app/oracle/oradata/PROD/disk2/users01.dbf was unintentionally renamed or moved, restore it7. If file /u01/app/oracle/oradata/PROD/disk5/example_01.dbf was unintentionally renamed or moved, restore it8. If file /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf was unintentionally renamed or moved, restore it9. If file /u01/app/oracle/oradata/PROD/disk5/test was unintentionally renamed or moved, restore it10. If file /u01/app/oracle/oradata/PROD/disk1/free_list was unintentionally renamed or moved, restore it11. If file /u01/app/oracle/oradata/PROD/disk2/users_01.dbf was unintentionally renamed or moved, restore it12. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf, then replace it with the correct one13. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbf, then replace it with the correct one14. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk2/users01.dbf, then replace it with the correct one15. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/example_01.dbf, then replace it with the correct one16. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/exam_01.dbf, then replace it with the correct one17. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk5/test, then replace it with the correct one18. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk1/free_list, then replace it with the correct one19. If you restored the wrong version of data file /u01/app/oracle/oradata/PROD/disk2/users_01.dbf, then replace it with the correct oneAutomated 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.hmRMAN> repair failure;Strategy: The repair includes point-in-time recovery with some data lossRepair script: /u01/app/oracle/diag/rdbms/prod/PROD/hm/reco_2383861944.hmcontents 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)? yesexecuting repair scriptStarting restore at 10-MAY-17using channel ORA_DISK_1channel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk5/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk4/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/disk2/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD/disk5/example_01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD/disk1/exam_01.dbfchannel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD/disk5/testchannel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD/disk1/free_listchannel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/PROD/disk2/users_01.dbfchannel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkpchannel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_nnndf_TAG20170510T211443_dk64l3rt_.bkp tag=TAG20170510T211443channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:45Finished restore at 10-MAY-17Starting recover at 10-MAY-17using channel ORA_DISK_1starting media recoverychannel ORA_DISK_1: starting archived log restore to default destinationchannel ORA_DISK_1: restoring archived logarchived log thread=1 sequence=4channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkpchannel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/PROD/backupset/2017_05_10/o1_mf_annnn_TAG20170510T211539_dk64mvk1_.bkp tag=TAG20170510T211539channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01archived log file name=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2017_05_10/o1_mf_1_4_dk68p08s_.arc thread=1 sequence=4channel 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=943655104media recovery complete, elapsed time: 00:00:00Finished recover at 10-MAY-17database openedrepair failure completeRMAN> exitRecovery Manager complete.[oracle@node1 PROD]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Wed May 10 22:26:08 2017Copyright (c) 1982, 2009, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> select open_mode, log_mode from v$database;OPEN_MODE LOG_MODE-------------------- ------------READ WRITE ARCHIVELOG
至此,数据库已经完全恢复,最然中间遇到了不少问题。
在restore database以及recover database过程中报错是因为对应的文件目录缺失导致,只要将对应缺失的目录重新创建出来后,重新进行回复就即可。
- RMAN 备份与恢复之所有文件都丢失
- RMAN备份与恢复之控制文件丢失
- RMAN备份与恢复之可脱机数据文件丢失
- RMAN备份与恢复之UNDO表空间丢失
- rman备份丢失控制文件恢复
- RMAN备份与恢复系列之redo日志文件恢复
- Oracle - 使用RMAN的备份及恢复一例-丢失所有控制文件
- 使用RMAN的备份及恢复一例-丢失所有控制文件
- RMAN备份与恢复之spfile恢复
- rman实验之归档模式有备份,正常关机丢失控制文件的恢复
- rman restore:在备份中恢复丢失的文件
- RMAN - 备份与恢复实践 之二
- RMAN 备份与恢复
- RMAN备份与恢复
- RMAN 备份与恢复
- rman备份与恢复
- Rman备份与恢复
- RMAN备份与恢复
- 操作DOM
- InfoGAN介绍
- window2008 r2 中文语言包
- RocketMQ源码解析:Message拉取&消费(下)
- 算法细节系列(15):Valid Parentheses系列
- RMAN 备份与恢复之所有文件都丢失
- centos 网络配置
- 字符串模式匹配的KMP算法实现
- android listview 长按弹出菜单--ContextMenu并进行删除操作
- 在Linux下设置spyder快捷键
- ResNeXt网络进化
- 美国孩子上学真像你以为的那么轻松吗?
- 2017-5-9 LINUX 笔记
- [编程之美-06]字符串回文判断