RMAN恢复控制文件
Posted ericnie的技术博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RMAN恢复控制文件相关的知识,希望对你有一定的参考价值。
查看目前的控制文件位置
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/control01.ctl
/u01/app/oracle/flash_recovery_area/orcl/control02.ctl
先备份一个控制文件
RMAN> backup current controlfile tag=‘bak_ctlfile‘ format=‘/home/oracle/backup/bak_ctl_%U_%T‘;
创建一个表空间
create tablespace xds datafile ‘/u01/app/oracle/oradata/cfpay/xds.dbf‘ size 10m autoextend off;
rm /u01/app/oracle/oradata/orcl/control01.ctl
rm /u01/app/oracle/flash_recovery_area/orcl/control02.ctl
shutdown abort
starup nomount
rman>restore controlfile from ‘/home/oracle/backup/bak_ctl_0ir8ibjo_1_1_20160619‘
SQL> alter database mount;
Database altered.
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.
再在rman中运用归档
RMAN> recover database;
starting media recovery
archived log for thread 1 with sequence 9 is already on disk as file /u01/app/oracle/oradata/orcl/redo03.log
archived log file name=/u01/app/oracle/oradata/orcl/redo03.log thread=1 sequence=9
creating datafile file number=7 name=/u01/app/oracle/oradata/orcl/xds.dbf
archived log file name=/u01/app/oracle/oradata/orcl/redo03.log thread=1 sequence=9
media recovery complete, elapsed time: 00:00:01
Finished recover at 19-JUN-16
SQL> /
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
/u01/app/oracle/oradata/orcl/xds.dbf
resetlogs方式打开数据库
SQL> alter database open resetlogs;
Database altered.
之后按照不同的备份没有问题.
以上是关于RMAN恢复控制文件的主要内容,如果未能解决你的问题,请参考以下文章
ORACLE11g 没有控制文件如何通过rman备份恢复数据的详细实战过程