当logfile被误删除后
一次误删 redo logfile 的故障中,每个 logfile group 仅有一个 member,直到该 logfile 成为 current 时才暴露出问题。数据库本身仍可正常运行,但 LNS 进程报错找不到被删除的 logfile,导致 lgwr async 模式下 redo 无法传输到 physical standby。原因在于:lgwr 进程始终持有所有 logfile 的文件句柄,因此即使文件被 rm 删除,lgwr 依然可以正常读写,数据库照常运行;而 LNS 进程只持有当前 logfile 的句柄,一旦日志切换到被删除的文件,LNS 就无法访问该文件,pfiles 的输出清晰印证了这一差异。
处理上,先在 primary 上清除该 logfile:依次执行 switch logfile 切换到好的 logfile group、checkpoint 让该 logfile 状态从 active 变为 inactive,再用 alter database clear unarchived logfile group x 清除(因为无法归档所以要加 unarchived)。但由于中间少了一个 archive log,physical standby 无法继续 recover,最终采用 incremental backup 的方式修复 standby,耗时约 6 小时,相比重建 standby 大约需要一个星期要划算得多。