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.

 

之后按照不同的备份没有问题.

 

posted @ 2016-06-19 19:51  ericnie  阅读(311)  评论(0编辑  收藏  举报