Oracle的load_balance和failover

jdbc:oracle:thin:@
 (description=(TRANSPORT_CONNECT_TIMEOUT=1)
  (address_list=(load_balance=off)(failover=on)
   (address=(protocol=tcp)(host=RAC1-vip)(port=1521))
   (address=(protocol=tcp)(host=RAC2-vip)(port=1521))
   (address=(protocol=tcp)(host=RAC3-vip)(port=1521)))
  (connect_data=(service_name=orcl)(failover_mode=(type=select)(method=basic)))
 ) 

LOAD_BALANCE=OFF,客户端进程首先会尝试连接 RAC1-vip,如果连不上,则会尝试RAC2-vip,如果再连不上就尝试RAC3-vip。如果设置为ON则会随机的选择一个做均衡负载。LOAD_BALANCE =on负载均衡,FAILOVER = on 失败自动切换,这两个参数是搭配在一起的。


LOAD_BALANCE
Purpose

To enable or disable client load balancing for multiple protocol addresses.
When you set the parameter to on, yes, or true, Oracle Net progresses the list of addresses in a random sequence, balancing the load on the various listener or Oracle Connection Manager protocol addresses. When you set the parameter to off, no, or false, Oracle Net tries the first address in the address list. If the connection fails and the failover parameter is enabled, then Oracle Net tries the addresses sequentially until one succeeds.
Put this parameter under either the DESCRIPTION_LIST parameter, the DESCRIPTION parameter, or the ADDRESS_LIST parameter.
Default
on for DESCRIPTION_LIST
Values
yes | on | true
no | off | false
Example
net_service_name=
 (DESCRIPTION= 
  (LOAD_BALANCE=on)
  (ADDRESS=(PROTOCOL=tcp)(HOST=sales1-svr)(PORT=1521))
  (ADDRESS=(PROTOCOL=tcp)(HOST=sales2-svr)(PORT=1521)))
  (CONNECT_DATA=(SERVICE_NAME=sales.us.example.com))

FAILOVER
Purpose

To enable or disable connect-time failover for multiple protocol addresses.
When you set the parameter to on, yes, or true, Oracle Net, at connect time, fails over to a different address if the first protocol address fails. When you set the parameter to off, no, or false, Oracle Net tries one protocol address.
Put this parameter under the DESCRIPTION_LIST parameter, the DESCRIPTION parameter, or the ADDRESS_LIST parameter.
Default
on for DESCRIPTION_LIST, DESCRIPTION, and ADDRESS_LIST.
Values
yes | on | true
no | off | false
Example
net_service_name=
 (DESCRIPTION= 
  (FAILOVER=on)
  (ADDRESS=(PROTOCOL=tcp)(HOST=sales1-svr)(PORT=1521))
  (ADDRESS=(PROTOCOL=tcp)(HOST=sales2-svr)(PORT=1521)))
  (CONNECT_DATA=(SERVICE_NAME=sales.us.example.com)))

你可能感兴趣的:(数据库)