oracle rman恢复时出现RMAN-06172: no autobackup found

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:390

oracle rman恢复时出现RMAN-06172: no autobackup found

在使用RMAN从AUTOBACKUP中恢复SPFILE,可能会碰到这个错误,这里简单总结一下。
在RMAN恢复SPFILE过程中,可能遇到下面的错误:
RMAN> restore spfile from autobackup;
Starting restore at 27-6月 -07
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=9 devtype=DISK
channel ORA_DISK_1: looking for autobackup on day: 20070627
channel ORA_DISK_1: looking for autobackup on day: 20070626
channel ORA_DISK_1: looking for autobackup on day: 20070625
channel ORA_DISK_1: looking for autobackup on day: 20070624
channel ORA_DISK_1: looking for autobackup on day: 20070623
channel ORA_DISK_1: looking for autobackup on day: 20070622
channel ORA_DISK_1: looking for autobackup on day: 20070621
channel ORA_DISK_1: no autobackup in 7 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/27/2007 17:54:30
RMAN-06172: no autobackup found or specified handle is not a valid copy or piece

一般来说,可能是下面三种情况之一。

第一种情况是没有配置CONTROLFILE AUTOBACKUP。
也就是说,在数据库中根本就没有自动备份的文件,恢复当然也是不可能的了。

第二种情况也比较常见,就是RMAN默认寻找7天内的自动备份,如果7天内没有发生自动备份,那么RMAN也无法找到这个文件。
这种情况的相应解决方法有两种,一种是RESTORE SPFILE FROM AUTOBACKUP UNTIL TIME ‘SYSDATE – N’的方法。另一种是RESTORE SPFILE FROM AUTOBACKUP MAXDAYS N。
采用这两种方法,可以保证

第三种情况也比较常见,而且更加隐蔽。这种情况是由于AUTOBACKUP的默认设置发生了变化。
由于这种情况在错误信息中看不到提示,所有很容易被忽略掉。由于在数据库目前只是通过RMAN的默认配置进行启动,且启动到NOMOUNT状态,因此RMAN的所有配置都无法获得,RMAN在尝试寻找AUTOBACKUP的时候,只会到默认路径下去寻找默认的格式,因此,如果以前修改过AUTOBACKUP的格式和路径,那么在恢复之前需要进行重新的设置。

AUTOBACKUP的存储路径在alert文件中可以找到。进行了设置后,就可以通过RMAN进行恢复了:

RMAN> set controlfile autobackup format for device type disk to '/data1/backup/testdata/%F';
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
RMAN> restore spfile from autobackup;
Starting restore at 27-6月 -07
using channel ORA_DISK_1
channel ORA_DISK_1: looking for autobackup on day: 20070627
channel ORA_DISK_1: autobackup found: /data1/backup/testdata/c-2270762593-20070627-00
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 27-6月 -07

如果不好确定恢复的格式或者明确想要恢复某个自动备份,那么还有一种方式更为直接,可以直接给出需要恢复的AUTOBACKUP的路径和文件名:
RMAN> [color=darkorchid]restore spfile from '/data1/backup/testdata/c-2270762593-20070626-01';
Starting restore at 27-6月 -07
using channel ORA_DISK_1
channel ORA_DISK_1: autobackup found: /data1/backup/testdata/c-2270762593-20070626-01
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 27-6月 -07

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】