RMAN 备份恢复 删除表空间后控制文件丢失

Posted ericnie的技术博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RMAN 备份恢复 删除表空间后控制文件丢失相关的知识,希望对你有一定的参考价值。

先备份一个控制文件

RMAN> backup current controlfile tag=‘bak_ctlfile‘ format=‘/home/oracle/backup/bak_ctl_%U_%T‘;

 

drop一个表空间

SQL> drop tablespace xds including contents and datafiles;

Tablespace dropped.

 

删除控制文件

rm /u01/app/oracle/oradata/orcl/control01.ctl

rm /u01/app/oracle/flash_recovery_area/orcl/control02.ctl

 

shutdown abort

 

采用rman恢复时报错

MAN> startup nomount;

Oracle instance started

Total System Global Area 835104768 bytes

Fixed Size 2217952 bytes
Variable Size 520095776 bytes
Database Buffers 310378496 bytes
Redo Buffers 2412544 bytes

RMAN> restore controlfile from ‘/home/oracle/backup/bak_ctl_0qr8l6u3_1_1_20160620‘;

Starting restore at 20-JUN-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/orcl/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/orcl/control02.ctl
Finished restore at 20-JUN-16

RMAN> mount database;

database mounted
released channel: ORA_DISK_1

RMAN> recover database;

Starting recover at 20-JUN-16
Starting implicit crosscheck backup at 20-JUN-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
Crosschecked 13 objects
Finished implicit crosscheck backup at 20-JUN-16

Starting implicit crosscheck copy at 20-JUN-16
using channel ORA_DISK_1
Finished implicit crosscheck copy at 20-JUN-16

searching for all files in the recovery area
cataloging files...
no files cataloged

using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/20/2016 21:53:14
RMAN-06094: datafile 7 must be restored

 

SQL> alter database datafile 7 offline;

Database altered.

SQL> recover database using backup controlfile;
ORA-00279: change 1106750 generated at 06/20/2016 21:31:26 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_20/o1_mf_1_3_%u_.arc
ORA-00280: change 1106750 for thread 1 is in sequence #3


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO
ORA-00308: cannot open archived log
‘/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_20/o1_mf_1_3_%u_.arc‘
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

因为还没有生成archivelog,所以找不到
手工一个个指定redolog文件,直到恢复

SQL> recover database using backup controlfile;
ORA-00279: change 1106750 generated at 06/20/2016 21:31:26 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_20/o1_mf_1_3_%u_.arc
ORA-00280: change 1106750 for thread 1 is in sequence #3


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/orcl/redo03.log
Log applied.
Media recovery complete.
SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/users01.dbf
/u01/app/oracle/oradata/orcl/example01.dbf
/u01/app/oracle/oradata/orcl/test01.dbf

6 rows selected.

SQL> alter database open resetlogs;

Database altered.

 

以上是关于RMAN 备份恢复 删除表空间后控制文件丢失的主要内容,如果未能解决你的问题,请参考以下文章

RMAN备份恢复 控制文件和归档日志丢失情况

一则关于控制文件全部丢失后如何重新编目RMAN元数据的简单实验

5. RAMN备份与恢复

如何从备份集中恢复归档日志

RMAN基础操作

RMAN 的优缺点及RMAN 备份及恢复步骤