ITPub博客

首页 > 数据库 > Oracle > RMAN在nocatalog状态下丢失所有文件的数据库恢复

RMAN在nocatalog状态下丢失所有文件的数据库恢复

原创 Oracle 作者:xingxintian 时间:2013-03-07 23:58:37 2 删除 编辑

前提设置了controlfile的autobackup

1、在实验前用RMAN执行了一个全备:

[oracle@victor1 PROD]$RMAN TARGET /

RMAN>BACKUP DATABASE;

确认数据文件和控制文件的备份位置

[oracle@victor1 PROD]$ ll
total 6784
-rw-r----- 1 oracle oinstall 6914048 Mar  7 20:29 backup_ctl_c-220439912-20130307-0b

[oracle@victor1 PROD]$ pwd
/u01/app/oracle/oradata/PROD

控制文件备份位置:

/u01/app/oracle/oradata/PROD/backup_ctl_c-220439912-20130307-0b

2、删除所有控制文件和数据文件

重新启动数据库实例,报如下错误:

SYS@PROD> startup
ORACLE instance started.

Total System Global Area  314572800 bytes
Fixed Size                  1219184 bytes
Variable Size              92276112 bytes
Database Buffers          218103808 bytes
Redo Buffers                2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info
确认控制文件缺失。

3、从控制文件备份中恢复控制文件。

[oracle@victor1 ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Mar 7 23:37:43 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: PROD (not mounted)

RMAN>  restore controlfile  from '/u01/app/oracle/oradata/PROD/backup_ctl_c-220439912-20130307-0b'
2> ;

Starting restore at 07-MAR-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=210 devtype=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output filename=/u01/app/oracle/oradata/PROD/disk3/ora_control1
output filename=/u01/app/oracle/oradata/PROD/disk4/ora_control2
output filename=/u01/app/oracle/oradata/PROD/disk5/ora_control3
Finished restore at 07-MAR-13

看来是成功恢复了。

3、进行数据库的RESTORE 和RECOVER

RMAN> restore database;

Starting restore at 07-MAR-13
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=210 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/PROD/disk1/system01.dbf
restoring datafile 00002 to /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/oradata/PROD/disk5/backup_0qo3v0v1_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/oradata/PROD/disk5/backup_0qo3v0v1_1_1 tag=TAG20130307T202817
channel ORA_DISK_1: restore complete, elapsed time: 00:03:43
Finished restore at 07-MAR-13

RMAN> recover database;

Starting recover at 07-MAR-13
using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 7 is already on disk as file /u01/app/oracle/oradata/PROD/disk3/redo01.log
archive log thread 1 sequence 8 is already on disk as file /u01/app/oracle/oradata/PROD/disk4/redo02.log
archive log filename=/u01/app/oracle/oradata/PROD/disk3/redo01.log thread=1 sequence=7
archive log filename=/u01/app/oracle/oradata/PROD/disk4/redo02.log thread=1 sequence=8
media recovery complete, elapsed time: 00:00:05
Finished recover at 07-MAR-13

4、最后sqlplus登录open数据库。

SYS@PROD> alter database open resetlogs;

Database altered.

5、查看数据库实例状态。

SYS@PROD> select status from V$instance;

STATUS
------------
OPEN

实验结束,成功恢复。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28538954/viewspace-755555/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2013-03-01

  • 博文量
    21
  • 访问量
    77524