15
Copyright (c) 1982, 2005, Oracle.? All rights reserved.
connected to target database (not started)
RMAN> startup nomount
Oracle instance started
Total System Global Area? ? 314572800 bytes
Fixed Size? ? ? ? ? ? ? ? ? ? 1261564 bytes
?Variable Size? ? ? ? ? ? ? ? 163577860 bytes
?Database Buffers? ? ? ? ? ? 142606336 bytes
?Redo Buffers? ? ? ? ? ? ? ? ? 7127040 bytes
这个时候查看rman的配置会发现,原有的配置都会丢失,因为我们删除了所有的数据。
RMAN> show all;
这个时候如果还原控制文件,指定autobackup就会报错,因为配置丢失,压根找不到备份的配置。
RMAN> restore controlfile from autobackup;
Starting restore at 02-AUG-15
?allocated channel: ORA_DISK_1
?channel ORA_DISK_1: sid=34 devtype=DISK
recovery area destination: /u02/oracle/flash_recovery_area
?database name (or database unique name) used for search: TEST10G
?channel ORA_DISK_1: no autobackups found in the recovery area
?autobackup search outside recovery area not attempted because DBID was not set
?RMAN-00571: ===========================================================
?RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
?RMAN-00571: ===========================================================
?RMAN-03002: failure of restore command at 08/02/2015 21:33:49
?RMAN-06172: no autobackup found or specified handle is not a valid copy or piece
这个时候,我们可以手工指定需要还原参照的控制文件备份即可。
?比如我们在备份目录下看到最新的控制文件备份,直接应用还原。
RMAN> restore controlfile from '/u02/oracle/flash_recovery_area/TEST10G/ctl_c-1135735312-20150802-0b';
Starting restore at 02-AUG-15
?using target database control file instead of recovery catalog
?allocated channel: ORA_DISK_1
?channel ORA_DISK_1: sid=38 devtype=DISK
channel ORA_DISK_1: restoring control file
?channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
?output filename=/u02/oracle/oradata/TEST10G/control01.ctl
?output filename=/u02/oracle/oradata/TEST10G/control02.ctl
?Finished restore at 02-AUG-15
然后数据库启动到Mount阶段,开始还原和恢复数据库,
RMAN> run{
?2> restore database;
?3> recover database;
?4> }
还原还是很平滑的过程,关键就在于恢复的过程,最后肯定会抛出一些问题来,类似下面的形式。
unable to find archive log
?archive log thread=1 sequence=1
?RMAN-00571: ===========================================================
?RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
?RMAN-00571: ===========================================================
?RMAN-03002: failure of recover command at 08/02/2015 21:37:15
?RMAN-06054: media recovery requesting unknown log: thread 1 seq 1 lowscn 1151365
这个时候我们就需要做不完全恢复,我们来采用基于sequence的恢复。
RMAN> run{
?2> set until sequence 1;
?3> recover database;
?4> }
然后使用resetlogs的方式就可以打开数据库了。
RMAN> alter database open resetlogs;
database opened
这种方式也还是相对比较简单的过程。
?第三种场景略微复杂。
?如果存在备份,但是备份集出现了一些问题,或者出现???一些归档文件的缺失,restore可以顺利完成,但是在recover的时候会报出下面的错误来。? ?
RMAN> recover database;
Starting recover at 02-AUG-15
?using channel ORA_DISK_1
?using channel ORA_DISK_2
starting media recovery
unable to find archived log
?archived log thread=1 sequence=1
?RMAN-00571: ===========================================================
?RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
?RMAN-00571: ===========================================================
?RMAN-03002: failure of recover command at 08/02/2015 12:26:43
?RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 1 and starting SCN of 1094536
这种情况下采用基于sequence的不完全恢复也没有基础。
?如果这个时候我们无招可用,看看resetlogs的方式能不能启动数据库,会有下面的