DataGuard - ORA-00261错误及解决方法
2024-07-21 02:09:49
供稿:网友
在dataguard环境中如果我们在做failover的时候,可能会碰到ora-00261错误,下面是该错误的产生原因和解决方法。
如果是由于网络问题而导致需要切换,那么通常standby端的rfs进程并不会意识到primary已经不可访问,所以rfs进程也不会释放当前的standby redo log文件。
如果是primary端的数据库实例由于故障中断,那么一般情况下standby端的rfs进程会立刻意识到primary已经不可访问,也就会立刻释放当前的standby redo log文件。
只要rfs进程没有释放standby redo log文件,那么执行alter database recover managed standby database finish命令就会在alertlog文件中发现如下的报错信息
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视图来监控rfs进程何时释放
实行failover:
alter database recover managed standby database finish;
alertlog中将显示如下信息,表示finish成功:
terminal incomplete recovery: until change 3738452
terminal incomplete recovery: end-of-redo log allocation
terminal incomplete recovery: log 4 reserved for thread 1 seq# 8772
terminal recovery changing datafile format version from 8.0.0.0.0 to 9.0.0.0.0
switching logfile format version from 8.0.0.0.0 to 9.0.0.0.0
terminal incomplete recovery: clearing standby redo logs.
terminal incomplete recovery: thread 1 seq# 8772 redo required
terminal incomplete recovery: end-of-redo log /global/oradata/ctsdb/stdby_redo04.log
identified end-of-redo for thread 1 sequence 8772
terminal incomplete recovery: end checkpoint scn 3738453
media recovery complete
switching logfile format version from 9.0.0.0.0 to 8.0.0.0.0
terminal incomplete recovery: successful completion
begin: wait for standby logfiles to be archived
wed sep 1 13:42:28 2004
arc1: evaluating archive log 4 thread 1 sequence 8772
wed sep 1 13:42:28 2004
arc0: evaluating archive log 4 thread 1 sequence 8772
wed sep 1 13:42:28 2004
arc1: beginning to archive log 4 thread 1 sequence 8772
wed sep 1 13:42:28 2004
arc0: unable to archive log 4 thread 1 sequence 8772
wed sep 1 13:42:28 2004
creating archive destination log_archive_dest_1: '/global/oradata/ctsdb/archive/arch1_8772.log'
wed sep 1 13:42:28 2004
log actively being archived by another process
wed sep 1 13:42:28 2004
arc1: completed archiving log 4 thread 1 sequence 8772
wed sep 1 13:42:43 2004
end: all standby logfiles have been archived
resetting standby activation id 4038461969 (0xf0b60a11)
completed: alter database recover managed standby database finish
finsh成功之后再执行switch:
alter database commit to switchover to primary;
switch成功之后,重新启动数据库:
shutdown immediate;
startup;