Oracle RAC TAF 無縫failover
理論背景:
TAF( Transparent Application Failover ) allows oracle clients to reconnect to a surviving instance in the event of a failure of the instance to which it is connected. There are two types of TAF available, SESSION and SELECT.
TAF允許oracle客戶端重新連線到一個可持續的例項,當客戶端連線的例項出現失敗時。有2種有效的TAF型別,session and select 。有2種模式在TAF建立的故障轉移連線,basic 和preconnect 。
session: 使用session方式,所有select查詢相關的結果在重新建立新的連線後將全部丟失,需要重新發布select命令。
select:select:使用select方式,Oracle net會跟蹤事務期間的所有select語句,並跟蹤每一個與當前select相關的遊標已返回多少行給客戶 端。此時,假定select查詢已返回500行,客戶端當前連線的節點出現故障,Oracle Net自動建立連線到倖存的例項上並繼續返回剩餘的行數給客戶端。假定總行數為1500,行,則1000行從剩餘節點返回。
BASIC: 客戶端透過地址列表成功建立連線後,即僅當客戶端感知到節點故障時才建立到其他例項的連線
PRECONNECT: 預連線模式,是在最初建立連線時就同時建立到所有例項的連線,當發生故障時,立刻就可以切換到其他鏈路上
說明:上述兩種方式適用於不同的情形,對於select方式,通常使用與OLAP資料庫,而對於session方式則使用與OLTP資料庫。因為 select 方式,Oracle 必須為每個session儲存更多的內容,包括遊標,使用者上下文等,需要更多的資源。其次,兩種方式期間所有未提交的DML事務將自動回滾且必須重啟啟動。alter session語句不會failover。臨時物件不會failover也不能被重新啟動。
配置Service-Side TAF 示例 (oracle使用者操作)
1 建立TAF Service
node1-> pwd
/u01/app/11.2.0/grid/bin
node1-> ./srvctl add service -d devdb -s server_taf -r "devdb1" -P BASIC
說明:
Srvctl add service -d -s -r "preferred-instance-list" -a "available-instance-list" -P
srvctl add service中,只有perferred才會建立服務。 即在OCR中註冊一個ora.raw.dmm.rac1.Srv的服務。
2 啟動 server_taf服務
node1-> ./srvctl start service -d devdb -s server_taf
3 檢查service 執行情況
node1-> ./srvctl config service -d devdb
Service name: server_taf
Service is enabled
Server pool: devdb_server_taf
Cardinality: 1
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: devdb1
Available instances:
4 確認service ID
SQL> select name,service_id from dba_services where name = 'server_taf';
NAMESERVICE_ID
---------------------------------------------------------------- ----------
server_taf 3
5 給service 新增引數
SQL> execute dbms_service.modify_service (service_name => 'server_taf' -
, 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);
> > > > > >
PL/SQL procedure successfully completed.
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;
NAMEMETHOD TYPERETRIES GOAL CLB_GOAL AQNOT
--------------- ----------- ---------- -------- ---------- -------- -----
server_tafBASIC SELECT 180 NONE LONG YES
7 檢查service 註冊情況
node1-> lsnrctl services
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 26-FEB-2017 04:43:55
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:2 refused:0 state:ready
LOCAL SERVER
Service "devdb" has 1 instance(s).
Instance "devdb1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "devdbXDB" has 1 instance(s).
Instance "devdb1", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER
(ADDRESS=(PROTOCOL=tcp)(HOST=node1.localdomain)(PORT=26677))
Service "server_taf" has 1 instance(s).
Instance "devdb1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
The command completed successfully
8 在客戶端就可以使用Service-Side TAF了
在客戶端TNS 配置:
server_taf =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan-cluster.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = server_taf)
)
)
連線測試
C:\Users\andy>sqlplus sys/oracle@10.100.25.8:1521/server_taf as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Sat Feb 25 20:59:41 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
9 停止service
node1-> ./srvctl stop service -d devdb -s server_taf -i devdb1
10 刪除service
node1-> ./srvctl remove service -d devdb -s server_taf -i devdb1
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31383567/viewspace-2134277/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle RAC 客戶端故障轉移(failover) TAFOracle客戶端AI
- TNSNAMES TAF TEMPLATE , LOCAL_LISTENER RAC FAILOVERAI
- Oracle RAC TAF [zt]Oracle
- Oracle Failover - TAF 透明應用切換OracleAI
- Oracle 10g RAC TAFOracle 10g
- Oracle RAC Failove 之二:TAFOracleAI
- 【TAF】使用Oracle RAC的TAF技術之SESSION型別OracleSession型別
- Oracle RAC Failover 詳解OracleAI
- oracle rac failover 詳解OracleAI
- oracle rac failover的疑惑OracleAI
- ORACLE RAC TAF 配置(透明故障轉移)Oracle
- Oracle 10g RAC TAF介紹Oracle 10g
- Oracle RAC的TAF簡單測試Oracle
- 物理DataGuard客戶端無縫切換--客戶端TAF 配置客戶端
- 轉:Oracle RAC Failover 詳解OracleAI
- oracle 11g rac TAF 測試方案Oracle
- 【TAF】使用Oracle RAC的TAF技術實現不間斷查詢Oracle
- Failover 之 Client-Side Connect time Failover、Client-Side TAF、Service-Side TAFAIclientIDE
- Oracle RAC Failover 詳解[轉帖]OracleAI
- [轉載]Oracle 10g RAC TAF介紹Oracle 10g
- Jdbc thin not suppot Rac TAFJDBC
- Linux平臺上Oracle Rac中的TAF配置LinuxOracle
- 在JDBC連線池中啟動Oracle RAC的TAFJDBCOracle
- Oracle RAC Failove 之三:Server-Side TAFOracleAIServerIDE
- 如何配置Oracle RAC Load Balance 及FailOverOracleAI
- 【DATAGUARD】物理dg配置客戶端無縫切換 (八.3)--客戶端TAF 配置客戶端
- RAC TAF 連線 (tnsnames.ora)
- [zt] Oracle RAC的Failover設定與測試OracleAI
- Oracle 11gR2 RAC Service-Side TAF 配置示例OracleIDE
- rac 的Client-side TAF配置clientIDE
- 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 RAC 客戶端FAILOVER LOADBALANCE特性的配置方法Oracle客戶端AI
- oracle的TAF淺析Oracle
- 【DATAGUARD】物理dg配置客戶端無縫切換 (八.2)--Fast-Start Failover 的配置客戶端ASTAI
- rac failover and load_balanceAI