填了如下几个坑:
1.新的主库如果对其他的备库不能ping的话,需要将fal_Server 和 log_arhive_config中涉及到的备库的名字去掉
2.新的主库的log_archive_dest_n去掉不能ping通的备库
3.主库查看备库传输的状态
select error,dest_id frm v$archive_dest where rownum < 6;
如果有错误提示,如ORA-16191,那说明是密码的问题
可以将主库的密码刷新后,再全部重新传输一次到所有的主备库上
刷新的方法应该采用alter user sys identified by xxx
,而不是去orapwd,因为修改了密码会自动同步到密码文件也同时会更新数据库中的数据字典
修改完成后,再去将相应的归档路径的state先改为defer,再改为enable,隔几十秒再去执行
select error,dest_id frm v$archive_dest where rownum < 6;
查看error是否消除
4.主库的switchover_status为RESOLVABLE GAP
说明主库和备库之间存在数据没有同步,需要先解决了才能进去切换
有几个状态:
– NOT ALLOWED
– On a primary database, this status indicates that there are no valid and enabled standby databases. On a standby database, this status indicates that a switchover request has not been received from the primary database.
SESSIONS ACTIVE
– The database has active sessions. On a physical standby database, the WITH SESSION SHUTDOWN SQL clause must be specified to perform a role transition while in this state. On a logical standby database, a role transition can be performed while in this state, but the role transition will not complete until all current transactions have committed.-
SWITCHOVER PENDING
– On a physical standby database, this status indicates that a switchover request has been received from the primary database and is being processed. A physical standby database cannot switch to the primary role while in this transient state. -
SWITCHOVER LATENT
– On a physical standby database, this status indicates that a switchover request was pending, but the original primary database has been switched back to the primary role. -
TO PRIMARY
– The database is ready to switch to the primary role. -
TO STANDBY
– The database is ready to switch to either the physical or logical standby role. -
TO LOGICAL STANDBY
– The database has received a data dictionary from a logical standby database and is ready to switch to the logical standby role. -
RECOVERY NEEDED
– On a physical standby database, this status indicates that additional redo must be applied before the database can switch to the primary role. -
PREPARING SWITCHOVER
– On a primary database, this status indicates that a data dictionary is being received from a logical standby database in preparation for switching to the logical standby role. On a logical standby database, this status indicates that the data dictionary has been sent to the primary database and other standby databases. -
PREPARING DICTIONARY
– On a logical standby database, this status indicates that the data dictionary is being sent to the primary database and other standby databases in preparation for switching to the primary role. -
FAILED DESTINATION
– On a primary database, this status indicates that one or more standby destinations are in an error state. -
RESOLVABLE GAP
– On a primary database, this status indicates that one or more standby databases have a redo gap that can be automatically resolved by fetching the missing redo from the primary database or from another standby database. -
UNRESOLVABLE GAP
– On a primary database, this status indicates that one or more standby databases have a redo gap that cannot be automatically resolved by fetching the missing redo from the primary database or from another standby database. -
LOG SWITCH GAP
– On a primary database, this status indicates that one or more standby databases are missing redo due to a recent log switch.
解决办法可以先参考第3条,如果没问题了,那么去查询主备库的最大日志号是否一样
select max(sequence#),inst_id from gv$archived_log group by inst_id;
如果不一致,可以看看主备库的alert日志报什么错
如果一致了,去查备库的alert日志,是否有media recovery
之类的提示,如果有,说明在实时恢复没如果没有说明没有实时应用日志进行恢复.
这个时候去查
select open_mode from v$database;
查看是否开启了实时应用,以及查看mrp进程是否存在
如果依然有正确,那就是看看lag有多少延迟
set linesize 200
col ctime format a20
col value format a20
select to_char(SYSDATE,'yyyymmdd hh24:mi:ss') CTIME,NAME,VALUE,DATUM_TIME from V$DATAGUARD_STATS WHERE NAME LIKE '%lag';
正常的应该是0,不正常的就会显示有多少分多少秒的延迟.
这个时候去查下备库的standby redo log的组数是不是不对,RAC环境有可能是因为thread两边的组数不一致.
如果以上再没有问题,那么就只有采取终极大法,重启备库了!