Oracle11g备库报ORA-00367和ORA-19527的问题

首先看一下alter.log文件中的错误信息(片段):
Tue Dec 22 06:00:47 2015
SRL log 13 needs clearing because log has not been created
Errors in file /app/sungard/oracle/diag/rdbms/futures8_standby/futures8/trace/futures8_rfs_29400.trc:
ORA-00367: checksum error in log file header
ORA-00315: log 13 of thread 0, wrong thread # 1 in header
ORA-00312: online log 13 thread 0: ‘/ora_data/oradata/futures8_standby/redo03.log’
SRL log 14 needs clearing because log has not been created
Errors in file /app/sungard/oracle/diag/rdbms/futures8_standby/futures8/trace/futures8_rfs_29400.trc:
ORA-00367: checksum error in log file header
ORA-00315: log 14 of thread 0, wrong thread # 1 in header
ORA-00312: online log 14 thread 0: ‘/ora_data/oradata/futures8_standby/redo04.log’

Oracle官方给出的引起这三个错的原因和处理的办法:
—————————————————————————————-
Error: ORA-00367
Cause: The file header for the redo log contains a checksum that does not match
the value calculated from the file header as read from disk. This means
the file header is corrupted
Action: Find the correct file and try again.
—————————————————————————————-
Error: ORA-00315
Cause: The online log is corrupted or is an old version.
Action: Find and install correct version of log or reset logs.
—————————————————————————————-
Error: ORA-00312
Cause: The control file change sequence number in the log file is greater
than the number in the control file. This implies that the wrong control
file is being used. Note that repeatedly causing this error can make it
stop happening without correcting the real problem.
Action: Use the current control file or do backup control file recovery to make the
control file current. Be sure to follow all restrictions on doing a backup
control file recovery.
—————————————————————————————-

根据官方提示可以看出,是因为控制文件中记录的SCN小于日志文件头部记录的SCN引起的,从而需要通过还原最新的控制文件来解决;这种方式是非常麻烦的,还需要还原数据文件并以resetlogs的方式打开;
除了以上办法,还可以通过清空日志文件的方式,来同步控制文件和日志头SCN:
ALTER DATABASE CLEAR LOGFILE GROUP 13;

命令执行之后会报另外的错误:
ORA-19527: physical standby redo log must be renamed
ORA-00312: online log 13 thread 0: ‘/ora_data/oradata/futures8_standby/redo03.log’

这个错误是10gR2之后功能的增强引起的:在做主备切换的时候,需要将备库的联机日志文件清除(CLEAR ONLINE REDO LOGFILE),为了加快SWITCHOVER的速度,Oracle10gR2之后在将备库置于MANGED STANDBY状态的时候就提前将这个CLEAR的动作做了,这个想法是好的,只是实现有点糟糕,然后会在alert.log文件里记录错误一堆错误;
This is in fact an Enhancement to the Data Guard Technology introduced in 10.2.0.
The Goal here is to improve speed of Switchover and Failover. In previous Versions a Role Transition would require to clear the Online Redo Logfiles before it can become a Primary Database. Now we attempt to clear the Online Redo Logfiles when starting Managed Recovery.
If the Files exist then they will be cleared, but if they do not exist we report the Error, attempts to create the Online Redo Logfiles and starts Recovery. Even if this is not possible because of different Structure and log_file_name_convert is not set, MRP does not fail; it only raises these Errors.
As an extra Enhancement if the Online Redologs do exist you must specify the log_file_name_convert Parameter even if there is no difference in the Name. This has been implemented to reduce the chances that the Primary Online Redologs are cleared when MRP starts. It is the equivalent of asking – Are you sure you want the logs to be called this….
If the log_file_name_convert parameter is not set then the ORA-19527 is reported and the log file is not cleared at this time..
Solution to stop both of these errors is to ensure log_file_name_convert is set correctly. If the File Structure is the same on the Primary and Standby Database you can set log_file_name_convert to a dummy Value;

好在给出了解决办法,只需要设置LOG_FILE_NAME_CONVERT参数即可,即便是主备目录是一致的,那么完整的解决办法如下:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
ALTER SYSTEM SET LOG_FILE_NAME_CONVERT=’/ora_data/oradata/futures8/’,’/ora_data/oradata/futures8/’,’/ora_data/oradata/futures8_standby/’,’/ora_data/oradata/futures8_standby/’ SCOPE=SPFILE;
STARTUP IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE CLEAR LOGFILE GROUP 13;
ALTER DATABASE CLEAR LOGFILE GROUP 14;
ALTER DATABASE CLEAR LOGFILE GROUP 15;
ALTER DATABASE CLEAR LOGFILE GROUP 16;
ALTER DATABASE CLEAR LOGFILE GROUP 17;
ALTER DATABASE CLEAR LOGFILE GROUP 18;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE [USING CURRENT LOGFILE] DISCONNECT FROM SESSION;
参考文档:Note 1532566.1, Note 352879.1