使用DMRMAN执行归档修复
使用REPAIR命令完成指定数据库的归档修复,归档修复会将目标库dmarch.ini中配置的所有本地归档日志目录执行修复。若目标库没有配置本地归档,则不执行修复。执行修复时,目标库一定不能处于运行状态。一般建议在数据库故障后,应立即执行归档修复,否则后续还原恢复导致联机日志中未刷入本地归档的REDO日志丢失,届时再利用本地归档恢复将无法恢复到故障前的最新状态。
语法如下:
REPAIRDATABASE < 'INI文件路径'>;
INI文件路径:指定待修复归档的数据库对应的dm.ini路径。
使用说明:
1) 单机环境时,确保目标库已经停止工作后,执行归档修复。
RMAN> repair archivelog database '/dm_home/dmdba/dmdbms/data/jydm/dm.ini'; repair archivelog database '/dm_home/dmdba/dmdbms/data/jydm/dm.ini'; checking if the database under system path [/dm_home/dmdba/dmdbms/data/jydm] is running...[4]. checking if the database under system path [/dm_home/dmdba/dmdbms/data/jydm] is running...[3]. checking if the database under system path [/dm_home/dmdba/dmdbms/data/jydm] is running...[2]. checking if the database under system path [/dm_home/dmdba/dmdbms/data/jydm] is running...[1]. checking if the database under system path [/dm_home/dmdba/dmdbms/data/jydm] is running...[0]. checking if the database under system path [/dm_home/dmdba/dmdbms/data/jydm] is running, write dmrman info. EP[0] max_lsn: 20383733 repair archive log successfully. repair time used: 6027.359(ms) time used: 6027.438(ms)
2) RAC环境时,需要每个节点停止工作后,且每个节点独立执行修复操作。对于两节点RAC01、RAC02执行修复如下。
RMAN> repair archivelog database '/dm7/data/rac0_config/dm.ini'; repair archivelog database '/dm7/data/rac0_config/dm.ini'; checking if the RAC database under system path [+DMDATA/data/rac] is running.... EP [0] is checking.... EP [1] is checking.... EP[0] max_lsn: 80140 repair archive log successfully. repair time used: 2237.302(ms) time used: 2237.565(ms) RMAN> repair archivelog database '/dm7/data/rac1_config/dm.ini'; repair archivelog database '/dm7/data/rac1_config/dm.ini'; file dm.key not found, use default license! checking if the RAC database under system path [+DMDATA/data/rac] is running.... EP [0] is checking.... EP [1] is checking.... EP[1] max_lsn: 80023 EP[1] adjust cur_lsn from [80023] to [80140] repair archive log successfully. repair time used: 2262.513(ms) time used: 2262.719(ms)