观察报错发现没有找到的备份信息主要都是thread 2的备份信息,结合上面ls命令的输出分析得出,线程为1日志序列号从14155至14166的归档日志虽然为2012-02-15 17:00之后的归档日志,但却仍再使用。使用restore archivelog from time "to_date('2012-02-15 17:00:00','yyyy-mm-dd hh24:mi:ss')";命令恢复时会提示already on disk。
结合list backup of archivelog from time "to_date('2012-02-15 17:00:00','yyyy-mm-dd hh24:mi:ss')";
和
node1
$ ls /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p1_C1
ls: 0653-341 The file /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p1_C1 does not exist
node2
$ ls /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_35n3e111_s5221_p1_C1
ls: 0653-341 The file /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_35n3e111_s5221_p1_C1 does not exist.
发现双节点都只有各自的备份文件,备份文件没有进行存储共享的配置(出于安全考虑,确实不应该把备份配置成共享的,不过设置成nfs挂载应该是没问题)。呵呵,犯了个低级错误。
经过以上分析得出,restore archivelog from time "to_date('2012-02-15 17:00:00','yyyy-mm-dd hh24:mi:ss')";命令会自动查找所需的备份文件进行还原,但是由于双节点无法同时访问所有需要备份文件,故需在特定节点还原指定的日志序列号,进行逐个还原,即 需要在相应的实例上还原相应thread对应的归档日志。
thread的意义: RAC环境下,多台主机同时访问位于共有的磁盘阵列的共同的数据库结构。每台主机上的数据库例程分别写自己的日志文件,不同的例程通过thread来区分。
于是根据list backup of archivelog from time "to_date('2012-02-15 17:00:00','yyyy-mm-dd hh24:mi:ss')"
命令得出的归档日志和备份信息,执行如下命令恢复
在RAC节点node 1上执行
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
set archivelog destination to '/arch_log/restore';
restore archivelog from logseq 14131 until logseq 14153 thread 1;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
在RAC节点node 2上执行
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
set archivelog destination to '/arch_log/restore';
restore archivelog from logseq 16148 until logseq 16181 thread 2;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
还原成功。
这里顺带说一句,如果需要进行数据库恢复,那么必须在能够访问所有归档日志的节点上进行,这里是node1
