Oracle 11g DG Broker配置服务的高可用(2)

datasource.url=jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.216)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.217)(PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = yes)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = cbl)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RETIRES = 180)(DELAY = 15))))

至此oracle 11g adg服务高可用配置完毕

总结:这时候可以测试下,当你主库shutdown abort的时候,你的从库自动转换成主库,然后触发器启动dbha服务,然后pmon自动注册监听,然后由于你配置了TAF特性,所以你的服务并不会报错(ORA-0133:ORACLE initialization or shutdown in progress错误),而是自动的连接到新的主库!

验证过程:

1.客户端配置tnsnames.ora

dbha=

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.21.178)(PORT = 1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.21.179)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = dbha)

)

)

2.使用dbha服务连接数据库,

[oracle@beijing-fuli-Hadoop-02 admin]$ sqlplus liuwenhe/liuwenhe@dbha

SQL*Plus: Release 11.2.0.4.0 Production on Sat Jul 13 17:11:55 2019

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

确认连接的是主库db2

SQL> select instance_name from v$instance;

INSTANCE_NAME

----------------

db2

3.异常关闭db2

SQL> shu abort

ORACLE instance shut down.

4.在之前连接好的会话继续查询实例名字,不报错但是卡着,因为主库db2已经关闭了,而dg库

db1还在自动转换中,所以都无法提供服务(大概10秒),然后连接上了db1:

SQL> select instance_name from v$instance;

INSTANCE_NAME

----------------

db2

SQL> select instance_name from v$instance; -----卡了10秒大概之后显示了db1

INSTANCE_NAME

----------------

db1

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/5875ec8bb9c04dae53d543667b4f49f7.html