Oracle RAC的TAF簡單測試
Oracle的的高可用功能除了負載均衡還包括TAF(Transparent Application Failover)。 RAC的TAF是指會話連線到一個例項上,如果這個例項出現了故障,Oracle會自動將會話遷移到另一個例項上。 看一個簡單的例子。首先不配置TAF,在客戶端TNSNAMES.ORA中進行如下的測試: TESTRAC = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.224)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.225)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = testrac) ) ) 現在沒有配置TAF,連線,檢查例項資訊: > CONN NDMAIN/NDMAIN@TESTRAC已連線。 SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; INSTANCE_NAME ---------------- testrac2 下面關閉TESTRAC2例項: $ srvctl stop instance -d testrac -i testrac2 再次檢查剛才連線的會話: SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; SELECT INSTANCE_NAME FROM V$INSTANCE *第 1 行出現錯誤: ORA-03113: 通訊通道的檔案結束 SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; ERROR: ORA-03114: 未連線到 ORALCE 執行操作後,Oracle會報上面的錯誤。下面啟動服務,配置TAF: TESTRAC = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.224)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.225)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = testrac) (FAILOVER_MODE = (TYPE = SESSION) (METHOD = BASIC) ) ) ) $ srvctl start instance -d testrac -i testrac2 重新登陸,檢查例項資訊: SQL> CONN NDMAIN/NDMAIN@TESTRAC已連線。 SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; INSTANCE_NAME ---------------- testrac1 再次關閉例項: $ srvctl stop instance -d testrac -i testrac1 檢查剛才的連線的會話: SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; INSTANCE_NAME ---------------- testrac1 SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; SELECT INSTANCE_NAME FROM V$INSTANCE *第 1 行出現錯誤: ORA-25408: 無法安全重放呼叫 SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; INSTANCE_NAME ---------------- testrac2 雖然報了一個錯誤ORA-25408,但是再次執行的時候,Oracle已經自動切換到例項TESTRAC2上了。 啟動TESTRAC1例項,然後關閉TESTRAC2例項: $ srvctl start instance -d testrac -i testrac1 $ srvctl stop instance -d testrac -i testrac2 再次檢查連線情況: SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; SELECT INSTANCE_NAME FROM V$INSTANCE *第 1 行出現錯誤: ORA-25408: 無法安全重放呼叫 SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; INSTANCE_NAME ---------------- testrac1 Oracle成功的切換回testrac1例項。Oracle這裡也存在一個問題,就是會產生ORA-25408錯誤。Oracle給出的解決方法是應用程式對這個錯誤進行處理。 如果將FAILOVER的TYPE改為SELECT模式,則也不會出現這個錯誤,首先修改TNSNAMES中的設定: TESTRAC = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.224)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.225)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = testrac) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) ) ) ) 然後啟動剛才關閉的TESTRAC2例項: $ srvctl start instance -d testrac -i testrac2 重新連線到例項: SQL> CONN NDMAIN/NDMAIN@TESTRAC已連線。 SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; INSTANCE_NAME ---------------- testrac1 關閉TESTRAC1例項: $ srvctl stop instance -d testrac -i testrac1 檢查會話連線的情況: SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; INSTANCE_NAME ---------------- testrac2 這時第一次執行SQL就成功了,沒有在出現ORA-25408錯誤。 |
上一篇簡單介紹了TAF,並透過具體的說明了SESSION和SELECT的區別。但是那個例子展示的只是二者區別的一個現象而已。真正的區別在於,配置了SELECT選項的FAILOVER在資料庫例項失敗時,會將會話切換到另一個例項,且將例項失敗時執行的SELECT語句繼續執行,並返回正確的結果。而SESSION則不具備這個功能。
先看看FAILOVER設定為SESSION的情況:
TESTRAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.224)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.225)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testrac)
(FAILOVER_MODE =
(TYPE = SESSION)
(METHOD = BASIC)
)
)
)
下面先看看FAILOVER設定為SESSION的情況:
SQL> CONN TEST/TEST@TESTRAC已連線。
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac2
SQL> SET PAUSE ON
SQL> SELECT TRIGGER_NAME FROM DBA_TRIGGERS;
TRIGGER_NAME
------------------------------
DEF$_PROPAGATOR_TRIG
REPCATLOGTRIG
XDB$ACL$xd
xdb-log9_TAB$xd
SERVLET$xd
ftp-log14_TAB$xd
http-log20_TAB$xd
Folder23_TAB$xd
XDB$STATS$xd
XDB$CONFIG$xd
XDBCONFIG_VALIDATE
XDB_RV_TRIG
XDB_PV_TRIG
CWM$DIMENSIONDEL
CWM$CUBEDEL
CWM2$AWVIEWSUPD
CWM2$AWVIEWCOLSUPD
CWM$CLASSIFICATIONUPD
.
.
.
EM_TARGETS_DELETE
BLACKOUT_CHANGE
BLACKOUT_STATUS
UPDATE_SOURCE
BLACKOUT_WINDOW_INSERT
HANDLE_RELATED_TARGETS
MGMT_METRIC_COLL_INS
利用PAUSE的暫停功能,然後在另一個會話中關閉當前連線例項:
$ srvctl stop instance -d testrac -i testrac2
返回剛才執行SQL的視窗,按回車繼續:
TRIGGER_NAME
------------------------------
MGMT_CREDS_UPD
MASTER_AGENT_CHANGE_TRIGGER
METRICS_INSERT_TRIGGER
TARGET_PROP_DEFS_TR
METRICS_DELETE
TARGETS_INSERT_TRIGGER
CHECK_DUPLICATE_TARGETS
RAW_METRICS_AFTER_INSERT
ERROR:
ORA-25401: 無法繼續讀取
已選擇105行。
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
雖然SELECT操作失敗了。但是再次執行SQL時成功了。而且會話已經切換到了另外一個例項上。
從上面的結果也可以看到SQLPLUS的一些處理方法。PAUSE主要起作用在執行後和每一頁的結束後。
而PAUSE和SQL結果的提取是沒有關係的。這也是為什麼在PAUSE繼續執行之後,仍然得到了一些記錄的原因。
而且從最終獲取105條記錄也可以看出,Oracle的FETCH操作是透過陣列進行的,在PAUSE的時候,這次陣列提取已經完成。而PAUSE結束後,本次獲取的資料可以顯示,再次提取的時候出現了錯誤。
SQL> SHOW ARRAY
arraysize 15
可以看到,Oracle實際執行了7次提取操作。
上面扯遠了一點,下面繼續看FAILOVER的SELECT表現。
首先修改tnsnames.ora中FAILOVER的配置:
TESTRAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.224)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.225)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testrac)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
)
)
)
然後將剛才的instance啟動:
$ srvctl start instance -d testrac -i testrac2
下面同樣執行上面那個SQL,注意這裡必須重新登陸一次,否則客戶端
TNSNAMES的修改無法對當前會話生效:
SQL> SET PAUSE OFF
SQL> CONN TEST/TEST@TESTRAC已連線。
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
SQL> SET PAUSE ON
SQL> SELECT TRIGGER_NAME FROM DBA_TRIGGERS;
TRIGGER_NAME
------------------------------
DEF$_PROPAGATOR_TRIG
REPCATLOGTRIG
XDB$ACL$xd
xdb-log9_TAB$xd
SERVLET$xd
ftp-log14_TAB$xd
http-log20_TAB$xd
Folder23_TAB$xd
XDB$STATS$xd
XDB$CONFIG$xd
XDBCONFIG_VALIDATE
XDB_RV_TRIG
XDB_PV_TRIG
.
.
.
UPDATE_SOURCE
BLACKOUT_WINDOW_INSERT
HANDLE_RELATED_TARGETS
MGMT_METRIC_COLL_INS
關閉當前會話連線的例項:
$ srvctl stop instance -d testrac -i testrac1
下面返回SQLPLUS會話,敲回車繼續:
TRIGGER_NAME
------------------------------
MGMT_CREDS_UPD
MASTER_AGENT_CHANGE_TRIGGER
METRICS_INSERT_TRIGGER
TARGET_PROP_DEFS_TR
METRICS_DELETE
TARGETS_INSERT_TRIGGER
CHECK_DUPLICATE_TARGETS
RAW_METRICS_AFTER_INSERT
METRIC_ERRORS_CUR_AND_DUPES
SEVERITY_DELETE
INSERT_FLAT_TARGETS
MGMT_JOB_EXEC_INSERT
JOB_CMD_BLK_DELETE_TRIGGER
JOB_EXEC_DELETE_TRIGGER
.
.
.
SDO_DROP_USER_BEFORE
SDO_DROP_USER
SDO_GEOR_DROP_USER
SDO_NETWORK_DROP_USER
SDO_GEOR_TRUNC_TABLE
已選擇164行。
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac2
這次不但將會話切換到了正常的例項上,而且SELECT也得到了完整的結果,沒有因例項故障而出現錯誤。這就是FAILOVER的SESSION和SELECT設定的區別。
這篇簡單討論一下TAF對事務的影響。
上一篇討論的主要是TAF對查詢的影響,那麼Oracle是否也能對資料的修改進行TAF,下面來看一個例子。
客戶端tnsnames.ora中的設定如下:
TESTRAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.224)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.225)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testrac)
(FAILOVER_MODE =
(TYPE = SESSION)
(METHOD = BASIC)
)
)
)
下面嘗試進行修改:
SQL> CONN TEST/TEST@TESTRAC已連線。
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
SQL> CREATE TABLE T (ID NUMBER);
表已建立。
SQL> INSERT INTO T VALUES (1);
已建立 1 行。
然後關閉當前連線的例項:
$ srvctl stop instance -d testrac -i testrac1
返回SQLPLUS介面執行任意SQL:
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
SELECT INSTANCE_NAME FROM V$INSTANCE
*第 1 行出現錯誤:
ORA-25402: 事務處理必須重新執行
SQL> SELECT * FROM T;
SELECT * FROM T
*第 1 行出現錯誤:
ORA-25402: 事務處理必須重新執行
SQL> DELETE T;
DELETE T
*第 1 行出現錯誤:
ORA-25402: 事務處理必須重新執行
SQL> COMMIT;
COMMIT
*第 1 行出現錯誤:
ORA-25402: 事務處理必須重新執行
SQL> ROLLBACK;
回退已完成。
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac2
可以看到,切換雖然成功了,但是執行任何操作都會返回ORA-25402錯誤,除非執行ROLLBACK操作。
將SESSION模式改為SELECT模式:
TESTRAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.224)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.225)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testrac)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
)
)
)
啟動剛才關閉的例項:
$ srvctl start instance -d testrac -i testrac1
重新連線,使得客戶端tnsnames.ora的修改生效。採用上一篇文章的方法,利用SQLPLUS的PAUSE命令觀察SELECT模式在進行了修改之後,是如何進行TAF的:
SQL> CONN TEST/TEST@TESTRAC已連線。
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
SQL> INSERT INTO T VALUES (1);
已建立 1 行。
SQL> SET PAUSE ON
SQL> SELECT TRIGGER_NAME FROM DBA_TRIGGERS;
TRIGGER_NAME
------------------------------
DEF$_PROPAGATOR_TRIG
REPCATLOGTRIG
XDB$ACL$xd
xdb-log9_TAB$xd
SERVLET$xd
ftp-log14_TAB$xd
http-log20_TAB$xd
Folder23_TAB$xd
.
.
.
UPDATE_SOURCE
BLACKOUT_WINDOW_INSERT
HANDLE_RELATED_TARGETS
MGMT_METRIC_COLL_INS
下面關閉連線的例項:
$ srvctl stop instance -d testrac -i testrac1
返回SQLPLUS敲回車繼續:
TRIGGER_NAME
------------------------------
MGMT_CREDS_UPD
MASTER_AGENT_CHANGE_TRIGGER
METRICS_INSERT_TRIGGER
TARGET_PROP_DEFS_TR
METRICS_DELETE
TARGETS_INSERT_TRIGGER
CHECK_DUPLICATE_TARGETS
RAW_METRICS_AFTER_INSERT
ERROR:
ORA-25402: 事務處理必須重新執行
已選擇105行。
現在得到了和昨天測試完全不一樣的結果。
上面的測試說明兩點問題。
首先,TAF是針對SESSION和SELECT的,它不支援事務的切換。其實想想也是有道理的,當連線的例項發生了故障,客戶端的連線發生了切換之後,SESSION資訊、INSTANCE資訊以及其他很多事務依賴的東西都不存在了,Oracle為了保證事務的完整性和一致性,必要要求使用者回滾事務。
第二,SELECT模式的TAF只對不包含任何事務處理的查詢有效。一旦使用者執行了修改操作,SELECT模式也無法在TAF之後將進行一半的查詢完成。
最後,如果啟用了TAF功能,那麼程式必須要新增處理ORA-25402錯誤的能力,否則一旦發生TAF切換,程式將一直報錯,而無法再進行任何操作。
這篇簡單討論一下TAF的BASIC方式和PRECONNECT方式。
TAF有兩種切換方式,BASIC方式和PRECONNECT方式。對於BASIC方式,所有設定了TAF的會話在當前例項失敗後,會連線到另外一個例項上。而對於PRECONNECT方式,每個連線的會話在主例項和例項上各連線一個會話,一旦主例項失敗,可以迅速的切換到備份例項。
首先看看普通BASIC方式的tnsnames.ora的設定:
TESTRAC_BASIC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.224)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.225)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testrac)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
)
)
)
下面看看PRECONNECT的配置:
TESTRAC_PRE1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.224)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.225)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testrac)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = PRECONNECT)
(BACKUP = TESTRAC_PRE2)
)
)
)
TESTRAC_PRE2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.224)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.225)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testrac)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = PRECONNECT)
(BACKUP = TESTRAC_PRE1)
)
)
)
對於BASIC方式的TAF:
SQL> CONN TEST/TEST@TESTRAC_BASIC已連線。
SQL> SELECT SID, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER
2 FROM V$SESSION
3 WHERE SID IN (SELECT SID FROM V$MYSTAT WHERE ROWNUM = 1);
SID FAILOVER_TYPE FAILOVER_M FAI
---------- ------------- ---------- ---
130 SELECT BASIC NO
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
透過SET TIMING ON來檢查觀察切換時間:
SQL> SET TIMING ON
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
已用時間: 00: 00: 00.01
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
已用時間: 00: 00: 00.01
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac2
已用時間: 00: 00: 00.25
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac2
已用時間: 00: 00: 00.00
在執行查詢的同時在另外的視窗關閉例項1:
bash-2.03$ srvctl stop instance -d testrac -i testrac1
下面看看PRECONNECT的情況,首先開啟例項:
bash-2.03$ srvctl start instance -d testrac -i testrac1
透過TESTRAC_PRE1服務名連線資料庫:
SQL> SET TIMING OFF
SQL> CONN TEST/TEST@TESTRAC_PRE1已連線。
SQL> SELECT SID, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER
2 FROM V$SESSION
3 WHERE SID IN (SELECT SID FROM V$MYSTAT WHERE ROWNUM = 1);
SID FAILOVER_TYPE FAILOVER_M FAI
---------- ------------- ---------- ---
149 SELECT PRECONNECT NO
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
執行剛才的操作,檢查PRECONNECT的TAF情況:
SQL> SET TIMING OFF
SQL> CONN TEST/TEST@TESTRAC_PRE1已連線。
SQL> SELECT SID, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER
2 FROM V$SESSION
3 WHERE SID IN (SELECT SID FROM V$MYSTAT WHERE ROWNUM = 1);
SID FAILOVER_TYPE FAILOVER_M FAI
---------- ------------- ---------- ---
149 SELECT PRECONNECT NO
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
SQL> SET TIMING ON
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
已用時間: 00: 00: 00.00
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
已用時間: 00: 00: 00.01
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac1
已用時間: 00: 00: 00.01
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac2
已用時間: 00: 00: 00.01
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac2
已用時間: 00: 00: 00.00
SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;
INSTANCE_NAME
----------------
testrac2
已用時間: 00: 00: 00.01
在查詢的同時管理例項testrac1:
bash-2.03$ srvctl stop instance -d testrac -i testrac1
資料庫負載很小,而且會話需要恢復的操作不多,所以切換時所需的時間不長,不過即使是這樣,透過對比BASIC和PRECONNECT所需的切換時間,也可以看到明顯的區別。
這篇簡單討論一下TAF伺服器端的PRECONNECT設定。
上一篇討論了客戶端配置PRECONNECT方式的TAF,下面介紹一下RAC伺服器端設定PRECONNECT服務的方法:
透過圖形介面啟動dbca;
在歡迎介面選擇Oracle Real Application Cluster database;
選擇Service Management;
選擇CLUSTER資料庫,這裡是testrac;
在Database Service介面新增要啟動的服務:PRE_TESTRAC,然後將TAF策略修改為Pre-connect,點選Finish,完成配置。
這是端的tnsnames.ora中新增了下面的配置:
PRE_TESTRAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PRE_TESTRAC)
(FAILOVER_MODE =
(BACKUP = PRE_TESTRAC_PRECONNECT)
(TYPE = SELECT)
(METHOD = PRECONNECT)
(RETRIES = 180)
(DELAY = 5)
)
)
)
PRE_TESTRAC_PRECONNECT =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PRE_TESTRAC_PRECONNECT)
(FAILOVER_MODE =
(BACKUP = PRE_TESTRAC)
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
同時,透過srvctl可以監控、管理建立的PER_TESTRAC服務:
bash-2.03$ srvctl status service -d testrac
Service PRE_TESTRAC is running on instance(s) testrac2, testrac1
建立了服務之後,客戶端可以直接配置PRE_TESTRAC這個服務,比如客戶端tnsnames.ora的配置為:
PRE_TESTRAC_SERVICE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.224)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.225)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PRE_TESTRAC)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = PRECONNECT)
(BACKUP = PRE_TESTRAC_PRECONNECT)
)
)
)
透過服務名PRE_TESTRAC_SERVICE建立的連線就啟用了PRECONNECT的TAF:
SQL> CONN TEST/TEST@PRE_TESTRAC_SERVICE已連線。
SQL> SELECT SID, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER
2 FROM V$SESSION
3 WHERE SID IN (SELECT SID FROM V$MYSTAT WHERE ROWNUM = 1);
SID FAILOVER_TYPE FAILOVER_M FAI
---------- ------------- ---------- ---
127 SELECT PRECONNECT NO
自:http://space.itpub.net/22198259/viewspace-659770
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22034023/viewspace-667617/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 11g rac TAF 測試方案Oracle
- Oracle RAC TAF [zt]Oracle
- RAC負載均衡的簡單測試(三)負載
- RAC負載均衡的簡單測試(二)負載
- RAC負載均衡的簡單測試(一)負載
- RAC負載均衡的簡單測試(四)負載
- 【TAF】使用Oracle RAC的TAF技術之SESSION型別OracleSession型別
- Oracle 10g RAC TAFOracle 10g
- Oracle logmnr簡單測試Oracle
- 關於oracle session的簡單測試OracleSession
- Oracle RAC TAF 無縫failoverOracleAI
- Oracle RAC Failove 之二:TAFOracleAI
- 【TAF】使用Oracle RAC的TAF技術實現不間斷查詢Oracle
- ORACLE RAC TAF 配置(透明故障轉移)Oracle
- Oracle 10g RAC TAF介紹Oracle 10g
- Oracle RAC序列效能測試Oracle
- Linux平臺上Oracle Rac中的TAF配置LinuxOracle
- 在JDBC連線池中啟動Oracle RAC的TAFJDBCOracle
- ORACLE EBS 安裝後的簡單基本測試方法Oracle
- [轉載]Oracle 10g RAC TAF介紹Oracle 10g
- 簡單的 ping 測試
- try的簡單效能測試
- Jdbc thin not suppot Rac TAFJDBC
- 【RAC】Oracle RAC上線測試場景介紹Oracle
- Oracle RAC Failove 之三:Server-Side TAFOracleAIServerIDE
- Oracle RAC 客戶端故障轉移(failover) TAFOracle客戶端AI
- 讓 API 測試變的簡單API
- Linux的OOMkiller簡單測試LinuxOOM
- mysql簡單效能測試MySql
- sql trace 簡單測試SQL
- oracle 10g RAC簡單管理Oracle 10g
- 【Oracle19c】Oracle19c rman使用簡單測試Oracle
- EasyReact的簡單試用及和RAC的對比React
- 使用python對oracle進行簡單效能測試PythonOracle
- rac 的Client-side TAF配置clientIDE
- [zt] Oracle RAC的Failover設定與測試OracleAI
- Oracle RAC Load Balance , Fail Over測試OracleAI
- Oracle 9i RAC enqueue等待測試OracleENQ