Oracle RAC Failove 之三:Server-Side TAF
1.定義
上一篇介紹的TAF是Client-Side,配置在客戶端的tnsname.ora檔案,如果有很多客戶端,將不利於維護,容易出錯,而這裡介紹的Server-Side TAF結合Service,把所有的TAF配置都儲存在資料字典中,這樣客戶端就無須再做配置了。
2.Service
1)建立一個新的service:
srvctl add service -d O01RCD0 -s taf_test -r O01RCD0A -a O01RCD0B -P basic
2)檢視service是否建立成功:
srvctl config service -d O01RCD0 -s taf_test -a
3)啟動該服務:
srvctl start service -d O01RCD0 -s taf_test
4)在資料庫上修改Service的TAF配置
begin
dbms_service.modify_service(
service_name=>'taf_test',
failover_method=>dbms_service.failover_method_basic,
failover_type=>dbms_service.failover_type_select,
failover_retries=>180,
failover_delay=>5
);
end;
/
PL/SQL procedure successfully completed.
5) 確認新Service已在資料字典裡存在
A105024@O01RCD0>select NAME,FAILOVER_METHOD,FAILOVER_TYPE,FAILOVER_DELAY from dba_services where NAME='taf_test';
NAME FAILOVER_METHOD FAILOVER_TYPE FAILOVER_DELAY
-------------------- --------------- --------------- --------------
taf_test BASIC SELECT 5
3.Listener的配置
我們需要新建一個listener監聽該service:
TNS_TAF_TEST =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = drcdd0ra)(PORT = 1521))
)
)
SID_LIST_TNS_TAF_TEST =
(SID_LIST =
(SID_DESC =
(SID_NAME = taf_test)
(ORACLE_HOME = /usr/local/oracle/10.2.0-64)
)
)
4.客戶端配置
客戶端配置很簡單,只要配置成通過service連線資料庫即可。
編輯tnsnames.ora檔案如下:
O01RCD0 =
(DESCRIPTION =
(failover = on)
(enable = broken)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = drcdd0ra)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = drcdd0rb)(PORT = 1521))
(LOAD_BALANCE = yes)
)
(CONNECT_DATA =
(SERVICE_NAME = taf_test)
)
)
)
4.測試
測試環境:兩節點的RAC (O01RCD0A,O01RCD0B)
連線資料庫,檢視連線到哪個例項:
A105024@O01RCD0>select INSTANCE_NAME,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
O01RCD0A OPEN
3)在服務端kill掉相應的服務程式以擬例項故障
查出使用者對應的OS服務程式id:
A105024@O01RCD0>select PID,SPID from v$process where ADDR in (select PADDR from v$session where username='A105024');
PID SPID
---------- ------------
43 28563
在OS上殺掉該程式:
kill -9 28563
4)稍等幾秒,再次執行語句,發現已經自動切換到了B節點
A105024@O01RCD0>select INSTANCE_NAME,status from v$instance;
A105024@O01RCD0>select INSTANCE_NAME,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
O01RCD0B OPEN
上一篇介紹的TAF是Client-Side,配置在客戶端的tnsname.ora檔案,如果有很多客戶端,將不利於維護,容易出錯,而這裡介紹的Server-Side TAF結合Service,把所有的TAF配置都儲存在資料字典中,這樣客戶端就無須再做配置了。
2.Service
1)建立一個新的service:
srvctl add service -d O01RCD0 -s taf_test -r O01RCD0A -a O01RCD0B -P basic
2)檢視service是否建立成功:
srvctl config service -d O01RCD0 -s taf_test -a
3)啟動該服務:
srvctl start service -d O01RCD0 -s taf_test
4)在資料庫上修改Service的TAF配置
begin
dbms_service.modify_service(
service_name=>'taf_test',
failover_method=>dbms_service.failover_method_basic,
failover_type=>dbms_service.failover_type_select,
failover_retries=>180,
failover_delay=>5
);
end;
/
PL/SQL procedure successfully completed.
5) 確認新Service已在資料字典裡存在
A105024@O01RCD0>select NAME,FAILOVER_METHOD,FAILOVER_TYPE,FAILOVER_DELAY from dba_services where NAME='taf_test';
NAME FAILOVER_METHOD FAILOVER_TYPE FAILOVER_DELAY
-------------------- --------------- --------------- --------------
taf_test BASIC SELECT 5
3.Listener的配置
我們需要新建一個listener監聽該service:
TNS_TAF_TEST =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = drcdd0ra)(PORT = 1521))
)
)
SID_LIST_TNS_TAF_TEST =
(SID_LIST =
(SID_DESC =
(SID_NAME = taf_test)
(ORACLE_HOME = /usr/local/oracle/10.2.0-64)
)
)
4.客戶端配置
客戶端配置很簡單,只要配置成通過service連線資料庫即可。
編輯tnsnames.ora檔案如下:
O01RCD0 =
(DESCRIPTION =
(failover = on)
(enable = broken)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = drcdd0ra)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = drcdd0rb)(PORT = 1521))
(LOAD_BALANCE = yes)
)
(CONNECT_DATA =
(SERVICE_NAME = taf_test)
)
)
)
4.測試
測試環境:兩節點的RAC (O01RCD0A,O01RCD0B)
連線資料庫,檢視連線到哪個例項:
A105024@O01RCD0>select INSTANCE_NAME,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
O01RCD0A OPEN
3)在服務端kill掉相應的服務程式以擬例項故障
查出使用者對應的OS服務程式id:
A105024@O01RCD0>select PID,SPID from v$process where ADDR in (select PADDR from v$session where username='A105024');
PID SPID
---------- ------------
43 28563
在OS上殺掉該程式:
kill -9 28563
4)稍等幾秒,再次執行語句,發現已經自動切換到了B節點
A105024@O01RCD0>select INSTANCE_NAME,status from v$instance;
A105024@O01RCD0>select INSTANCE_NAME,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
O01RCD0B OPEN
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26277071/viewspace-710961/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle RAC Failove 之二:TAFOracleAI
- Oracle RAC TAF [zt]Oracle
- Oracle 10g RAC TAFOracle 10g
- Oracle RAC TAF 無縫failoverOracleAI
- 【TAF】使用Oracle RAC的TAF技術之SESSION型別OracleSession型別
- ORACLE RAC TAF 配置(透明故障轉移)Oracle
- Oracle 10g RAC TAF介紹Oracle 10g
- Oracle RAC的TAF簡單測試Oracle
- oracle 11g rac TAF 測試方案Oracle
- 【TAF】使用Oracle RAC的TAF技術實現不間斷查詢Oracle
- [轉載]Oracle 10g RAC TAF介紹Oracle 10g
- Jdbc thin not suppot Rac TAFJDBC
- Linux平臺上Oracle Rac中的TAF配置LinuxOracle
- 在JDBC連線池中啟動Oracle RAC的TAFJDBCOracle
- Oracle RAC 客戶端故障轉移(failover) TAFOracle客戶端AI
- Oracle RAC Failove 之一:Client-Side Connect Time FailoverOracleAIclientIDE
- RAC TAF 連線 (tnsnames.ora)
- Oracle 11gR2 RAC Service-Side TAF 配置示例OracleIDE
- rac 的Client-side TAF配置clientIDE
- VMWARE+linux+oracle 10g RAC 之三LinuxOracle 10g
- oracle10g rac(rhel4)_load balancing_taf(一)Oracle
- oracle10g rac(rhel4)_load balancing_taf(二)Oracle
- oracle10g rac(rhel4)_load balancing_taf(三)Oracle
- oracle10g rac(rhel4)_load balancing_taf(四)Oracle
- oracle的TAF淺析Oracle
- TNSNAMES TAF TEMPLATE , LOCAL_LISTENER RAC FAILOVERAI
- 【RAC】RAC中的負載均衡和故障切換--TAF配置負載
- 11gr2 RAC配置Service-Side TAFIDE
- Oracle LOAD_BALANCE&TAF總結Oracle
- 【Oracle】Oracle常用EVENT之三Oracle
- 【RAC】Creating a filesystem physical standby from ASM (RAC ) primary之三ASM
- Oracle Failover - TAF 透明應用切換OracleAI
- Swift Server-sideSwiftServerIDE
- oracle taf unknown 問題處理過程Oracle
- oracle v$lock系列之三Oracle
- 靈活實現RAC三節點的負載均衡及TAF配置(五)負載
- 靈活實現RAC三節點的負載均衡及TAF配置(二)負載
- 靈活實現RAC三節點的負載均衡及TAF配置(一)負載