oracle11gdgbroker开启fast-startfailover自动故障切换
一.首先保证主从数据库的闪回数据库功能以及强制归档都打开,如下保证都为yes
SQL> select flashback_on,force_logging from v$database;
FLASHBACK_ON FOR
------------------ ---
NO NO
1.1开启闪回数据库
SQL> ALTER SYSTEM SET db_recovery_file_dest_size=3g SCOPE=BOTH;
System altered.
SQL> alter system set db_recovery_file_dest='/data/u01/app/oracle/fast_recovery_area';
System altered.
SQL> alter database flashback on;
Database altered.
1.2开启强制归档
SQL> alter database force logging;
Database altered.
SQL> select flashback_on,force_logging from v$database;
FLASHBACK_ON FOR
------------------ ---
YES YES
二:开启fast-start failover
2.1:开启 fast-start failover
[oracle@beijing-fuli-hadoop-02 ~]$ dgmgrl sys/
oracle@db2
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> enable fast_start failover;
Enabled.
2.2.查看配置状态,发现警告,因为没有启动observer而告警!
DGMGRL> show configuration
Configuration - dbha_c
Protection Mode: MaxPerformance
Databases:
db2 - Primary database
Warning: ORA-16819: fast-start failover observer not started
db1 - (*) Physical standby database
Warning: ORA-16819: fast-start failover observer not started
Fast-Start Failover: ENABLED
Configuration Status:
WARNING
2.3开启 启动观察器(observer):
DGMGRL> show configuration
Configuration - dbha_c
Protection Mode: MaxPerformance
Databases:
db2 - Primary database
db1 - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
由于observer的启动会一直占用session 窗口的,所以建议写成脚本挂后台
这里我们在备库上创建脚本,具体如下
创建一个名叫observer.sql的脚本,把下面的命令放进去,然后执行该脚本即可。
nohup dgmgrl sys/oracle@db2 "start observer">>observer.log 2>&1 &
三:验证自动切换:
db2主库:
SQL> select DATABASE_ROLE,OPEN_MODE from v$database;
DATABASE_ROLE OPEN_MODE
---------------- --------------------
PRIMARY READ WRITE
db1为standby
SQL> select DATABASE_ROLE,OPEN_MODE from v$database;
DATABASE_ROLE OPEN_MODE
---------------- --------------------
PHYSICAL STANDBY READ ONLY WITH APPLY
db2主库模拟异常关闭
SQL> shu abort
ORACLE instance shut down.
再次查看db1的状态:
SQL> select DATABASE_ROLE,OPEN_MODE from v$database;
DATABASE_ROLE OPEN_MODE
---------------- --------------------
PRIMARY READ WRITE
当前题目:oracle11gdgbroker开启fast-startfailover自动故障切换
分享地址:http://pwwzsj.com/article/ihjehd.html