【TAF】使用Oracle RAC的TAF技術之SESSION型別
《【TAF】使用Oracle RAC的TAF技術實現不間斷查詢》(http://space.itpub.net/519536/viewspace-676654)文中談到當FAILOVER_MODE型別為SELECT時可以實現查詢語句不間斷的返回結果。另外一種型別是SESSION,看一看SESSION型別會給我們帶來什麼樣的效果。
1.在tnsnames.ora檔案中新增測試連線串
RACDB1@rac1 /home/oracle$ vi $ORACLE_HOME/network/admin/tnsnames.ora
testractafsession =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RACDB)
(FAILOVER_MODE =
(TYPE = SESSION)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
注意,此處配置的FAILOVER_MODE中的TYPE是“SESSION”。
2.使用testractaf連線串連線到資料庫
RACDB1@rac1 /home/oracle$ sqlplus sec/sec@testractafsession
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Oct 25 21:16:47 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
RACDB1
可見,此時sqlplus連線到了RAC的第一個例項RACDB1上。
3.手工停止RACDB1例項
[root@rac2 ~]# srvctl stop instance -d RACDB -i RACDB1
4.重新確認查詢語句所在例項
SQL> select instance_name from v$instance;
select instance_name from v$instance
*
ERROR at line 1:
ORA-25408: can not safely replay call
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
RACDB2
此時在原sqlplus介面下提交查詢SQL語句後立即收到“ORA-25408: can not safely replay call”錯誤,但是,再次提交同樣的查詢便會得到結果,結果表明此時已經切換到另外一個例項RACDB2上。
這裡的報錯和不使用TAF技術的報錯是有本質區別的,這裡最重要的優勢是:不需要重新發起連線。
5.恢復例項RACDB1,繼續
[root@rac2 ~]# srvctl start instance -d RACDB -i RACDB1
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
RACDB2
6.此處我們模擬一個長時間無法返回全部資訊的查詢語句
SQL> select * from all_objects a,all_objects b,all_objects c where a.object_id=b.object_id and a.object_id=c.object_id;
…… 此處省略輸出資訊 ……
7.手工停止RACDB2例項
[root@rac2 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac2
ora....DB1.srv application ONLINE ONLINE rac1
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
[root@rac2 ~]# srvctl stop instance -d RACDB -i RACDB2
[root@rac2 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application OFFLINE OFFLINE
ora.RACDB.db application ONLINE ONLINE rac2
ora....DB1.srv application ONLINE ONLINE rac1
ora....DB2.srv application ONLINE OFFLINE
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
8.結論
當RACDB2例項終止後,持續返回的結果資訊被中斷,緊隨其後的是報錯資訊“ORA-25401: can not continue fetches”,在報錯的同時該連線已經重新連線到其他可用的資料庫例項上,後續的SQL語句不受影響。
錯誤提示資訊如下:
…… 省略輸出資訊 ……
…… 省略輸出資訊 ……
ERROR:
ORA-25401: can not continue fetches
2085 rows selected.
SQL>
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
RACDB1
9.小結
本文給出了當故障來臨時在FAILOVER_MODE中TYPE選擇“SESSION”時的應對特點,此時與“SELECT”型別有一些區別。例項故障出現時,這裡選擇了報錯並終止。在這種配置下可以結合具體應用來應對這些報錯。在具體應用設計的過程中需要充分考慮Failover不同模式下的應對方案。
Good luck.
secooler
10.10.25
-- The End --
1.在tnsnames.ora檔案中新增測試連線串
RACDB1@rac1 /home/oracle$ vi $ORACLE_HOME/network/admin/tnsnames.ora
testractafsession =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RACDB)
(FAILOVER_MODE =
(TYPE = SESSION)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
注意,此處配置的FAILOVER_MODE中的TYPE是“SESSION”。
2.使用testractaf連線串連線到資料庫
RACDB1@rac1 /home/oracle$ sqlplus sec/sec@testractafsession
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Oct 25 21:16:47 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
RACDB1
可見,此時sqlplus連線到了RAC的第一個例項RACDB1上。
3.手工停止RACDB1例項
[root@rac2 ~]# srvctl stop instance -d RACDB -i RACDB1
4.重新確認查詢語句所在例項
SQL> select instance_name from v$instance;
select instance_name from v$instance
*
ERROR at line 1:
ORA-25408: can not safely replay call
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
RACDB2
此時在原sqlplus介面下提交查詢SQL語句後立即收到“ORA-25408: can not safely replay call”錯誤,但是,再次提交同樣的查詢便會得到結果,結果表明此時已經切換到另外一個例項RACDB2上。
這裡的報錯和不使用TAF技術的報錯是有本質區別的,這裡最重要的優勢是:不需要重新發起連線。
5.恢復例項RACDB1,繼續
[root@rac2 ~]# srvctl start instance -d RACDB -i RACDB1
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
RACDB2
6.此處我們模擬一個長時間無法返回全部資訊的查詢語句
SQL> select * from all_objects a,all_objects b,all_objects c where a.object_id=b.object_id and a.object_id=c.object_id;
…… 此處省略輸出資訊 ……
7.手工停止RACDB2例項
[root@rac2 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac2
ora....DB1.srv application ONLINE ONLINE rac1
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
[root@rac2 ~]# srvctl stop instance -d RACDB -i RACDB2
[root@rac2 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application OFFLINE OFFLINE
ora.RACDB.db application ONLINE ONLINE rac2
ora....DB1.srv application ONLINE ONLINE rac1
ora....DB2.srv application ONLINE OFFLINE
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
8.結論
當RACDB2例項終止後,持續返回的結果資訊被中斷,緊隨其後的是報錯資訊“ORA-25401: can not continue fetches”,在報錯的同時該連線已經重新連線到其他可用的資料庫例項上,後續的SQL語句不受影響。
錯誤提示資訊如下:
…… 省略輸出資訊 ……
…… 省略輸出資訊 ……
ERROR:
ORA-25401: can not continue fetches
2085 rows selected.
SQL>
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
RACDB1
9.小結
本文給出了當故障來臨時在FAILOVER_MODE中TYPE選擇“SESSION”時的應對特點,此時與“SELECT”型別有一些區別。例項故障出現時,這裡選擇了報錯並終止。在這種配置下可以結合具體應用來應對這些報錯。在具體應用設計的過程中需要充分考慮Failover不同模式下的應對方案。
Good luck.
secooler
10.10.25
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28389881/viewspace-1251093/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【TAF】使用Oracle RAC的TAF技術實現不間斷查詢Oracle
- oracle taf type型別為session和select的區別Oracle型別Session
- Oracle RAC TAF [zt]Oracle
- Oracle 10g RAC TAFOracle 10g
- Oracle RAC的TAF簡單測試Oracle
- Oracle RAC TAF 無縫failoverOracleAI
- Oracle RAC Failove 之二:TAFOracleAI
- ORACLE RAC TAF 配置(透明故障轉移)Oracle
- Oracle 10g RAC TAF介紹Oracle 10g
- Jdbc thin not suppot Rac TAFJDBC
- oracle 11g rac TAF 測試方案Oracle
- oracle的TAF淺析Oracle
- Linux平臺上Oracle Rac中的TAF配置LinuxOracle
- 在JDBC連線池中啟動Oracle RAC的TAFJDBCOracle
- [轉載]Oracle 10g RAC TAF介紹Oracle 10g
- rac 的Client-side TAF配置clientIDE
- RAC TAF 連線 (tnsnames.ora)
- Oracle RAC Failove 之三:Server-Side TAFOracleAIServerIDE
- Oracle RAC 客戶端故障轉移(failover) TAFOracle客戶端AI
- TNSNAMES TAF TEMPLATE , LOCAL_LISTENER RAC FAILOVERAI
- Oracle 11gR2 RAC Service-Side TAF 配置示例OracleIDE
- 【RAC】RAC中的負載均衡和故障切換--TAF配置負載
- Oracle LOAD_BALANCE&TAF總結Oracle
- 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
- 11gr2 RAC配置Service-Side TAFIDE
- Oracle Failover - TAF 透明應用切換OracleAI
- Service-side TAFIDE
- oracle taf unknown 問題處理過程Oracle
- Failover 之 Client-Side Connect time Failover、Client-Side TAF、Service-Side TAFAIclientIDE
- 靈活實現RAC三節點的負載均衡及TAF配置(五)負載
- 靈活實現RAC三節點的負載均衡及TAF配置(二)負載
- 靈活實現RAC三節點的負載均衡及TAF配置(一)負載
- 靈活實現RAC三節點的負載均衡及TAF配置(四)負載
- 靈活實現RAC三節點的負載均衡及TAF配置(三)負載
- LOAD_BALANCE&TAF總結