FAL_SERVER设置错误导致SWITCHOVER切换HANG住

客户在进行DATA GUARD的SWITCHOVER时,操作长时间没有反应。
操作如下:

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;

这个命令等待很长时间没有结束,虽然数据库的SWITCHOVER_STATUS并非TO STANDBY而是SESSION ACTIVE,但是几乎所有的LOCAL=NO的连接已经在操作系统级kill掉了,而且使用了WITH SESSION SHUTDOWN语法,理论上不应该是连接问题导致SWITCHOVER无法完成。
检查告警日志:

Fri Oct 14 23:03:45 2011
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN
Fri Oct 14 23:03:45 2011
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY (db1)
Fri Oct 14 23:03:47 2011
Thread 1 cannot allocate NEW log, SEQUENCE 133983
Private strand FLUSH NOT complete
CURRENT log# 4 seq# 133982 mem# 0: /dev/rredodbs41
CURRENT log# 4 seq# 133982 mem# 1: /dev/rredodbs42
Fri Oct 14 23:03:50 2011
Thread 1 advanced TO log SEQUENCE 133983 (LGWR switch)
CURRENT log# 5 seq# 133983 mem# 0: /dev/rredodbs51
CURRENT log# 5 seq# 133983 mem# 1: /dev/rredodbs52
Fri Oct 14 23:03:50 2011
Waiting FOR ALL non-CURRENT ORLs TO be archived...
Fri Oct 14 23:03:50 2011
Waiting FOR the ORL FOR thread 1 SEQUENCE 133982 TO be archived...
Fri Oct 14 23:04:00 2011
ORL FOR thread 1 SEQUENCE 133982 has been archived...
Fri Oct 14 23:04:00 2011
ALL non-CURRENT ORLs have been archived.
Fri Oct 14 23:04:00 2011
Waiting FOR ALL FAL entries TO be archived...
Fri Oct 14 23:25:29 2011
ORA-1013 signalled during: ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN...

数据库在等待和FAL配置有关,由于数据库的操作一直停在了这里,最后不得以中止了SWITCHOVER的操作。
检查客户的FAL相关配置,发现FAL_SERVER的设置可能存在问题:

SQL> SHOW PARAMETER FAL 
NAME                       TYPE        VALUE
-------------------------- ----------- --------------------
fal_client                 string      db1
fal_server                 string      db1st,db1st2

由于当前主库配置了两个STANDBY数据库,分别是db1st和db2st,当前的设置明显是希望无论主库和那个备库进行切换后,通过设置两个fal_server,DATA GUARD配置都可以正常,而不需要修改配置。
但是目前看来,似乎这种设置两个参数的方式并不生效,使得在SWITCHOVER的时Oracle停了下来。
将FAL_SERVER设置为要进行SWITCHOVER的备库的TNS服务名:

SQL> ALTER SYSTEM SET fal_server='db1st';
System altered.

重启数据库,使得参数生效。虽然这个参数的修改不需要重启数据库,但是在运行SWITCHOVER的时候发现,如果不重启数据库,Oracle并没有重新获取FAL_SERVER的值,而是根据本次启动时加载的FAL_SERVER的值。
重新启动后再次运行SWITCHOVER,切换成功完成:

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
DATABASE altered.

一直认为FAL_SERVER和FAL_CLIENT只是DATA GUARD配置用来自动获取GAP的参数,没想到这个参数的设置对于SWITCHOVER也有这么大的影响。

This entry was posted in ORACLE and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *