oracle11g在没DNS情况下failover的配置方法

1.Oracle 11g引入scan ip ,可在没有DNS的情况下,客户端连接RAC配置failover时,很多情况还是使用oracle10g方式。即在客户端tnsname.ora中配置failover:
1)当客户端配置如下时,连接的实例关闭后,会话必须重新连才可连接到其他活动的实例上,不会自动重连:
ora112 = 
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.87.113)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.87.114)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ora112)
(FAILOVER = on)
)
)

ora112 = 
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.87.113)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.87.114)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ora112)
(FAILOVER = on)
(TYPE = select)
(METHOD = basic)
(RETRIES = 180)
(DELAY = 5)
)
)
或(115为scan-ip)
ORA112 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.87.115)(PORT = 1521))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ora112)
      (FAILOVER = on)
    )
  )

ORA112 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.87.115)(PORT = 1521))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ora112)
      (FAILOVER = on)
      (failover_mode=(TYPE=SELECT)
      (METHOD=BASIC)
      (RETRIES=1)
      (DELAY=0)
    )
    )
  )

ORA112 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.87.115)(PORT = 1521))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ora112)
    )
  )
2)当客户端配置如下时,连接的实例关闭后,会话会自动连接到其他活动的实例上:
ora112 = 
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.87.113)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.87.114)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ora112)
(FAILOVER = on)
FAILOVER_MODE=(TYPE = select)
(METHOD = basic)
(RETRIES = 180)
(DELAY = 5)
)
)
)
2.如果不采用oracle10g的方法,能不能只在客户端配置scan ip,而在服务器端配置以实现failover,具体如下:
(How To Configure Server Side Transparent Application Failover [ID 460982.1])
1)创建TAFService
[oracle@db1 bin]$ ./srvctl add service -d ora112 -s ora112_rac -r "ora1121,ora1122" -P BASIC
--这里的ora112是database name,ora1121和ora1122 是instance name。
2)启动s_test服务
[oracle@db1 bin]$ ./srvctl start service -d ora112 -s s_test
3)检查service运行情况
[oracle@db1 bin]$ ./srvctl config service -d ora112
Service name: s_test
Service is enabled
Server pool: ora112_s_test
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition: 
Preferred instances: ora1121,ora1122
Available instances:
4)确认serviceID
SQL> select name,service_id from dba_services where name = 's_test';
NAME SERVICE_ID
--------------------------------------------------------------------------
s_test 3
5)为service添加参数
SQL> execute dbms_service.modify_service (service_name => 's_test' - 
, aq_ha_notifications => true - 
, failover_method => dbms_service.failover_method_basic - 
, failover_type => dbms_service.failover_type_select - 
, failover_retries => 180 - 
, failover_delay => 5 - 
, clb_goal => dbms_service.clb_goal_long); 
6)确认参数添加情况
col name format a15 
col failover_method format a11 heading 'METHOD' 
col failover_type format a10 heading 'TYPE' 
col failover_retries format 9999999 heading 'RETRIES' 
col goal format a10 
col clb_goal format a8 
col AQ_HA_NOTIFICATIONS format a5 heading 'AQNOT' 
SQL> select name, failover_method,failover_type, failover_retries,goal, clb_goal,aq_ha_notifications from dba_services where service_id = 3; 
NAME METHOD TYPE RETRIES GOAL CLB_GOAL AQNOT
--------------- ----------- ------------------ ---------- -------- -----
s_test BASIC SELECT 180 NONE LONG YES
SQL>
7)检查service注册情况
[oracle@db1 bin]$ lsnrctl services
LSNRCTL for Linux: Version 11.2.0.3.0 -Production on 15-JUL-2012 13:26:43
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db1)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for thisservice...
Handler(s):
"DEDICATED" established:57 refused:0 state:ready
LOCAL SERVER
Service "ora112" has 1 instance(s).
Instance "ora1121", status READY, has 1 handler(s) for thisservice...
Handler(s):
"DEDICATED" established:11 refused:0 state:ready
LOCAL SERVER
Service "ora112XDB" has 1instance(s).
Instance "ora1121", status READY, has 1 handler(s) for thisservice...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER
(ADDRESS=(PROTOCOL=tcp)(HOST=db1.tianlesoftware.com)(PORT=38731))
Service "s_test" has 1instance(s).
Instance "ora1121", status READY, has 1 handler(s) for thisservice...
Handler(s):
"DEDICATED" established:11 refused:0 state:ready
LOCAL SERVER
The command completed successfully
8)配置tnsnames.ora,连接后,关闭连接实例后,会话会自动切换到其他活动实例上(115为scan ip):
ORA112 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.87.115)(PORT = 1521))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = s_test)
    )
  )

你可能感兴趣的:(service,dns,oracle11g,Failover,scanip)