在database guard上,做failover的时候,有时候会遭遇到ORA-00261的错误。 
 
 查一下error 
 
 
  
 [oracle@solaris ~]oerr ORA 00261 
  
 00261, 00000, “log %s of thread %s is being archived or modified” 
  
 // *Cause: The log is either being archived by another process or an 
  
 // administrative command is modifying the log. Operations that 
  
 // modify the log include clearing, adding a member, dropping a 
  
 // member, renaming a member, and dropping the log. 
  
 // *Action: Wait for the current operation to complete and try again. 
 
 
 
 可以看到是当前的log还是使用,从而导致失败。 
 
 在failover发生上面错误,主要是因为standby端的RFS进程没有意识到primary已经不可访问,所以RFS没有释放当前对 standby log的使用,从而导致上面的问题。一般这样的故障时由于网络故障导致,standby无法获得多primary实例的状态,如果primary端的数据 库实例由于故障中断,那么一般情况下standby端的RFS进程会立刻意识到primary已经不可访问,也就会立刻释放当前的standby redo log文件。 
 
 只要rfs没有释放standby redo log文件,那么执行alter database recover managed standby database finish就会出现上面的错误。 
 
 在日志里可以发现如下的错误片段。 
 
 Warning: log 4 of thread 1 is being archived or modified 
 
 Recovery interrupted. 
 
 Media Recovery failed with error 261 
 
 这时如果进行switch的话,出现 
 
 ORA-16139: media recovery required 
 
 所以必须检查alertlog文件,直到发现如下信息才表示RFS进程已经释放了standby redo log文件,这时候才可以作FINISH: 
 
 RFS: Possible network disconnect with primary database 
 
 这时候我们可以手动的促使rfs释放standby redo log 
 
 1. 等待RFS进程的network timeout,通常需要等待8分钟左右 
 
 2.关闭standby数据库,再重新开启,强制RFS进程释放standby redo log 
 
 v$managed_standby视图可以观察到dg里的进程状态 
 
 finish成功之后再执行switch: 
 
 alter database commit to switchover to primary; 
 
 switch成功之后,重新启动数据库: 
 
 shutdown immeaite 
 
 startup 
 
 










