在使用rman从autobackup中恢复spfile,可能会碰到这个错误,这里简单总结一下。在rman恢复spfile过程中,可能遇到下面的错误:rm
在使用rman从autobackup中恢复spfile,可能会碰到这个错误,这里简单总结一下。
在rman恢复spfile过程中,可能遇到下面的错误:
rman> restore spfile from autobackup;
启动 restore 于 07-10月-11
使用通道 ora_disk_1
通道 ora_disk_1: 寻找以下日期的 autobackup: 20111007
通道 ora_disk_1: 寻找以下日期的 autobackup: 20111006
通道 ora_disk_1: 寻找以下日期的 autobackup: 20111005
通道 ora_disk_1: 寻找以下日期的 autobackup: 20111004
通道 ora_disk_1: 寻找以下日期的 autobackup: 20111003
通道 ora_disk_1: 寻找以下日期的 autobackup: 20111002
通道 ora_disk_1: 寻找以下日期的 autobackup: 20111001
通道 ora_disk_1: 没有找到 7 天之内的 autobackup
rman-00571: ===========================================================
rman-00569: =============== error message stack follows ===============
rman-00571: ===========================================================
rman-03002: restore 命令 (在 10/07/2011 20:25:14 上) 失败
rman-06172: 没有找到 autobackup, 或者指定的句柄不是有效副本或片段
一般来说,可能是下面三种情况之一。
第一种情况是没有配置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> restore spfile from 'd:\app\backup\orcl\autobackup\2011_10_07\o1_mf_s_763934613_78xtnpq2_.bkp';
启动 restore 于 07-10月-11
使用通道 ora_disk_1
通道 ora_disk_1: 正在从 autobackup d:\app\backup\orcl\autobackup\2011_10_07\o1_mf_s_763934613_78xtnpq2_.bkp 还原 spfile
通道 ora_disk_1: 从 autobackup 还原 spfile 已完成
完成 restore 于 07-10月-11