【RAC】RAC中的負載均衡和故障切換--TAF配置
【RAC】RAC中的負載均衡和故障切換--TAF配置
涉及到的內容包括:
Oracle RAC 客戶端連線負載均衡(Load Balance)
實現負載均衡(Load Balance)是Oracle RAC最重要的特性之一,主要是把負載平均分配到叢集中的各個節點,以提高系統的整體吞吐能力。通常情況下有兩種方式來實現負載均衡,一個是基於客戶端連線的負載均衡,一個是基於伺服器端監聽器(Listener)收集到的資訊來將新的連線請求分配到連線數較少例項上的實現方式。本文主要討論的是基於客戶端連線的負載均衡,並給出演示。
與負載均衡配置之前的監聽配置請參考
ORACLE RAC 監聽配置 (listener.ora tnsnames.ora)
ORACLE RAC 下非預設埠監聽配置(listener.ora tnsnames.ora)
一、客戶端的負載均衡
客戶端的負載均衡主要是透過為tnsnames.ora增加load_balance=yes條目來實現,下面看看oracle(Note:226880.1)的解釋
The client load balancing feature enables clients to randomize connection requests among the listeners. Oracle Net progresses through the list of
protocol addresses in a random sequence, balancing the load on the various listeners. Without client load balancing, Oracle Net progresses through the
list of protocol addresses sequentially until one succeeds. This normally is referred to connect-time load balance.
從上面的描述中可以得知,如果未開啟load_balance=yes時,Oracle Net會根據地址列表按順序來選擇一個進行連線,直到連線成功為止。
如果第一個host主機連線失敗,在有多個地址的情形下,接下來選擇第二個地址連線,依此類推,直到連線成功為止。
當開啟了load_balance=yes時,則Oracle Net會從多個地址中隨機地選擇一個地址進行連線,直到連線成功為止。
注意,此連線方式僅根據地址列表隨機選擇,並不考慮到各個例項上當前真正連線數量的多少,也即是沒有考慮各個節點真實的連線負載情況。
二、伺服器與客戶端的配置情況
- 1、伺服器端監聽器配置
- oracle@bo2dbp:~> more $ORACLE_HOME/network/admin/listener.ora --#節點bo2dbp上的listener
- # listener.ora.bo2dbp Network Configuration File: /u01/oracle/db/network/admin/listener.ora.bo2dbp
- # Generated by Oracle configuration tools.
- LISTENER_NEW_BO2DBP =
- (DESCRIPTION_LIST =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = bo2dbp-vip.2gotrade.com)(PORT = 1314)(IP = FIRST))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.51)(PORT = 1314)(IP = FIRST))
- )
- )
- ...........................--#其餘部分省略,注意此處的配置是使用了1314的非預設監聽器埠號
- oracle@bo2dbs:/u01/oracle/db/network/admin> more listener.ora --#節點bo2dbs上的listener
- # listener.ora.bo2dbs Network Configuration File: /u01/oracle/db/network/admin/listener.ora.bo2dbs
- # Generated by Oracle configuration tools.
- LISTENER_NEW_BO2DBS =
- (DESCRIPTION_LIST =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = bo2dbs-vip.2gotrade.com)(PORT = 1314)(IP = FIRST))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.52)(PORT = 1314)(IP = FIRST))
- )
- )
- ...............
- 2、引數配置
- -->instrance ora10g1上的引數配置
- SQL> show parameter instance_na
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- instance_name string ora10g1
- SQL> show parameter listener
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- local_listener string local_lsnr_ora10g1
- remote_listener string remote_lsnr_ora10g
- -->instrance ora10g2上的引數配置
- SQL> show parameter instance_name
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- instance_name string ora10g2
- SQL> show parameter listener
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- local_listener string local_lsnr_ora10g2
- remote_listener string remote_lsnr_ora10g
- -->instrance ora10g2上的監聽資訊
- SQL> ho ps -ef | grep lsnr
- oracle 17372 1 0 11:00 ? 00:00:00 /u01/oracle/db/bin/tnslsnr LISTENER_NEW_BO2DBS -inherit
- oracle 17502 24301 0 12:10 pts/0 00:00:00 /bin/bash -c ps -ef | grep lsnr
- oracle 17504 17502 0 12:10 pts/0 00:00:00 grep lsnr
- SQL> ho lsnrctl status LISTENER_NEW_BO2DBS
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.62)(PORT=1314)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.52)(PORT=1314)))
- Services Summary...
- Service "ora10g" has 2 instance(s).
- Instance "ora10g1", status READY, has 1 handler(s) for this service...
- Instance "ora10g2", status READY, has 2 handler(s) for this service...
- ..........
- -->由於只是測試基於客戶端的load balance,因此移出remote_listener引數
- SQL> alter system reset remote_listener scope=both sid='*';
- alter system reset remote_listener scope=both sid='*'
- *
- ERROR at line 1:
- ORA-32009: cannot reset the memory value for instance * from instance ora10g2
- SQL> alter system reset remote_listener scope=spfile sid='*';
- System altered.
- SQL> ho srvctl stop database -d ora10g -->關閉資料庫ora10g
- SQL> ho srvctl start database -d ora10g -->啟動資料庫ora10g使得剛剛修改的remote_listener生效
- SQL> ho lsnrctl status LISTENER_NEW_BO2DBS -->此時可以看到只有ora10g2註冊到監聽器
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.62)(PORT=1314)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.52)(PORT=1314)))
- Services Summary...
- Service "PLSExtProc" has 1 instance(s).
- Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
- Service "ora10g" has 1 instance(s).
- Instance "ora10g2", status READY, has 1 handler(s) for this service...
- ..........
- oracle@bo2dbp:~> lsnrctl status LISTENER_NEW_BO2DBP #同樣在節點bo2dbp也只有ora10g1註冊到監聽器
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.61)(PORT=1314)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.51)(PORT=1314)))
- Services Summary...
- Service "ora10g" has 1 instance(s).
- Instance "ora10g1", status READY, has 1 handler(s) for this service...
- .........
- 3、客戶端配置
- SZDB:~ # ifconfig eth1 | grep "inet addr"|cut -d " " -f12|cut -d : -f2 #客戶端主機的ip
- 192.168.7.2
- SZDB:~ # su - oracle
- oracle@SZDB:~> cat /etc/hosts --#客戶端主機新增了RAC上的兩個虛擬節點的ip資訊
- 192.168.7.61 bo2dbp-vip.2gotrade.com bo2dbp-vip
- 192.168.7.62 bo2dbs-vip.2gotrade.com bo2dbs-vip
- oracle@SZDB:~> tail -12 $ORACLE_HOME/network/admin/tnsnames.ora
- ORA10G =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = bo2dbp-vip.2gotrade.com)(PORT = 1314))
- (ADDRESS = (PROTOCOL = TCP)(HOST = bo2dbs-vip.2gotrade.com)(PORT = 1314))
- (LOAD_BALANCE = yes)
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = ora10g)
- )
- )
三、測試負載均衡(load balance)
- 1、啟用load balance的測試
- oracle@SZDB:~> more load_balance.sh
- #!/bin/bash
- for i in {1..100}
- do
- echo $i
- sqlplus -S system/oracle@ORA10G <<EOF
- select instance_name from v\$instance;
- EOF
- sleep 1
- done
- exit 0
- # Author: Robinson Cheng
- # Blog : http://blog.csdn.net/robinson_0612
- oracle@SZDB:~> ./load_balance.sh >load_bal.log
- oracle@SZDB:~> head -20 load_bal.log
- 1
- INSTANCE_NAME
- ----------------
- ora10g2
- 2
- INSTANCE_NAME
- ----------------
- ora10g1
- 3
- INSTANCE_NAME
- ----------------
- ora10g2
- 4
- oracle@SZDB:~> grep ora10g1 load_bal.log |wc -l
- 47
- oracle@SZDB:~> grep ora10g2 load_bal.log |wc -l
- 53
- 從上面的log日誌中可以看出啟用客戶端的負載均衡基本上使得從客戶端發起連線的能夠保持均衡。
- 2、未啟用load balance的測試
- 從客戶端的tnsnames.ora中移出(LOAD_BALANCE = yes)選項,然後繼續使用上面的指令碼來測試
- oracle@SZDB:~> grep ora10g1 no_load_bal.log |wc -l
- 100
- oracle@SZDB:~> grep ora10g2 no_load_bal.log |wc -l
- 0
- 從上面的日誌中可以看出當移出LOAD_BALANCE = yes項後,所有的使用者連線請求都被定為到ora10g1,這是因為連線請求從tnsnames.ora中選擇
- 列在ADDRESS項中排在第一行的位置。
- 下面我們關閉例項ora10g1,再來測試連線情形
- oracle@bo2dbp:~> srvctl stop instance -d ora10g -i ora10g1
- oracle@SZDB:~> ./load_balance.sh >no_load_bal_new.log
- oracle@SZDB:~> grep ora10g1 no_load_bal_new.log |wc -l
- 0
- oracle@SZDB:~> grep ora10g2 no_load_bal_new.log |wc -l
- 100
- 由於例項ora10g1已經關閉,因此所有的連線請求都被分配到ora10g2。
四、總結
1、客戶端的負載均衡配置較為簡單,僅僅是在客戶端的tnsnames.ora新增 LOAD_BALANCE = yes |on
2、其連線分配原則是根據tnsnames.ora中連線識別符號下的ADDRESS列表隨機選擇來進行與伺服器之間的連線
3、如果選擇列表中的某個節點listener或instance不可用,則再從剩餘的ADDRESS列表隨機選擇,直到成功為止
Oracle RAC 伺服器端連線負載均衡(Load Balance)
Oracle RAC伺服器端的負載均衡是根據RAC中各節點的連線負荷數情況,將新的連線請求分配到負荷最小的節點上去。當資料庫處於執行時,RAC中各節點的PMON程式每3秒會將各自節點的連線負荷數更新到service_register。而對於節點中任意監聽器故障或監聽器意外失敗時,PMON程式會每1秒鐘檢查當前節點上的監聽是否重啟,以獲得最新的負載資訊來及時調整負載均衡。本文主要演示suse 10 + oracle 10g rac下的伺服器端的負載均衡。
有關客戶端的負載均衡可參考
Oracle RAC 客戶端連線負載均衡(Load Balance)
配置RAC負載均衡與故障轉移
有關Oracle 網路配置相關基礎以及概念性的問題請參考:
配置ORACLE 客戶端連線到資料庫
配置非預設埠的動態服務註冊
配置sqlnet.ora限制IP訪問Oracle
Oracle 監聽器日誌配置與管理
設定 Oracle 監聽器密碼(LISTENER)
Oracle RAC 監聽配置
ORACLE RAC 下非預設埠監聽配置(listener.ora tnsnames.ora)
一、伺服器端負載均衡配置
- 1、為tnsnames.ora 新增相應的網路服務名(每個節點配置)
- oracle@bo2dbp:~> more $ORACLE_HOME/network/admin/tnsnames.ora
- # tnsnames.ora Network Configuration File: /u01/oracle/db/network/admin/tnsnames.ora
- # Generated by Oracle configuration tools.
- remote_lsnr_gobo4 =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
- )
- local_lsnr_gobo4a =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
- )
- local_lsnr_gobo4b =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
- )
- 2、設定remote_listener引數
- alter system set remote_listener='<net_service_name>' scope=both sid='*';
- SQL> show parameter instance_name
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- instance_name string GOBO4A
- SQL> show parameter listener
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- local_listener string
- remote_listener string
- SQL> alter system set remote_listener='remote_lsnr_gobo4' scope=both sid='*';
- System altered.
- 3、配置客戶端tnsnames.ora
- -->客戶端為suse 10
- SZDB:~ # ifconfig eth1 | grep "inet addr"|cut -d " " -f12|cut -d : -f2 #--客戶端主機的ip
- 192.168.7.2
- SZDB:~ # su - oracle
- oracle@SZDB:~> tail -10 $ORACLE_HOME/network/admin/tnsnames.ora
- GOBO4 =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
- (LOAD_BALANCE = off) #--由於僅僅測試寄予伺服器端的負載均衡,因此關閉客戶端負載均衡選項
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = GOBO4)
- )
- )
- #Author : Robinson Cheng
- #Blog : http://blog.csdn.net/robinson_0612
- 4、檢查監聽情況
- oracle@bo2dbp:~> lsnrctl status
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.61)(PORT=1521)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.51)(PORT=1521)))
- Services Summary...
- Service "+ASM" has 1 instance(s).
- Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...
- Service "GOBO4" has 2 instance(s).
- Instance "GOBO4A", status READY, has 2 handler(s) for this service...
- Instance "GOBO4B", status READY, has 1 handler(s) for this service..
- .......
- oracle@bo2dbs:~> lsnrctl status
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.62)(PORT=1521)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.52)(PORT=1521)))
- Services Summary...
- Service "+ASM" has 1 instance(s).
- Instance "+ASM2", status BLOCKED, has 1 handler(s) for this service...
- Service "GOBO4" has 2 instance(s).
- Instance "GOBO4A", status READY, has 1 handler(s) for this service...
- Instance "GOBO4B", status READY, has 2 handler(s) for this service...
- ..........
- #--如果監聽或資料庫需要重啟異常請考慮重新啟動監聽器或資料庫
- #--下面清空監聽日誌以便於後續統計連線資訊
- oracle@bo2dbp:/u01/oracle/db/network/log> cat /dev/null>listener_bo2dbp.log
- oracle@bo2dbs:/u01/oracle/db/network/log> cat /dev/null>listener_bo2dbs.log
二、測試伺服器端的負載均衡
- 1、從客戶端建立連線
- oracle@SZDB:~> more load_balance.sh
- #!/bin/bash
- for i in {1..1000}
- do
- echo $i
- sqlplus -S system/oracle@GOBO4 <<EOF
- select instance_name from v\$instance;
- EOF
- sleep 1
- done
- exit 0
- oracle@SZDB:~> ./load_balance.sh >srv_load_bal.log
- 2、分析監聽日誌
- oracle@bo2dbp:/u01/oracle/db/network/log> more listener_bo2dbp.log
- 12-OCT-2012 12:00:10 * service_update * GOBO4B * 0 #節點bo2dbs上的例項GOBO4B的更新到bo2dbp上監聽器的更新資訊
- 12-OCT-2012 12:00:35 * service_update * GOBO4B * 0
- 12-OCT-2012 12:01:04 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=GOBO4)(CID=(PROGRAM=sqlplus@SZDB)(HOST=SZDB)
- (USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.2)(PORT=50322)) * establish * GOBO4 * 0
- 12-OCT-2012 12:01:05 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=GOBO4)(CID=(PROGRAM=sqlplus@SZDB)(HOST=SZDB)
- (USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.2)(PORT=50325)) * establish * GOBO4 * 0
- 12-OCT-2012 12:01:07 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=GOBO4)(CID=(PROGRAM=sqlplus@SZDB)(HOST=SZDB)
- (USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.2)(PORT=50328)) * establish * GOBO4 * 0
- 12-OCT-2012 12:01:08 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=GOBO4)(CID=(PROGRAM=sqlplus@SZDB)(HOST=SZDB)
- (USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.2)(PORT=50330)) * establish * GOBO4 * 0
- #上面的日誌片斷中可以看出全部是客戶端發起的到bo2dbp節點上的建立連線的資訊
- #下面來檢視bo2dbs上的監聽日誌
- oracle@bo2dbs:/u01/oracle/db/network/log> more listener_bo2dbs.log
- 12-OCT-2012 12:00:10 * service_update * GOBO4B * 0
- 12-OCT-2012 12:00:10 * service_update * GOBO4B * 0
- 12-OCT-2012 12:00:14 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=bo2dbs)(USER=oracle))(COMMAND=status)(ARGUMENTS=64)
- (SERVICE=LISTENER_BO2DBS)(VERSION=169870080)) * status * 0
- 12-OCT-2012 12:00:35 * service_update * GOBO4B * 0
- 12-OCT-2012 12:00:35 * service_update * GOBO4B * 0
- 12-OCT-2012 12:01:04 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=GOBO4)(CID=(PROGRAM=sqlplus@SZDB)(HOST=SZDB)
- (USER=oracle))(INSTANCE_NAME=GOBO4B)) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.2)(PORT=61862)) * establish * GOBO4 * 0
- 12-OCT-2012 12:01:07 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=GOBO4)(CID=(PROGRAM=sqlplus@SZDB)(HOST=SZDB)
- (USER=oracle))(INSTANCE_NAME=GOBO4B)) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.2)(PORT=61868)) * establish * GOBO4 * 0
- 12-OCT-2012 12:01:09 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=GOBO4)(CID=(PROGRAM=sqlplus@SZDB)(HOST=SZDB)
- (USER=oracle))(INSTANCE_NAME=GOBO4B)) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.2)(PORT=61872)) * establish * GOBO4 * 0
- #在12-OCT-2012 12:01:04時刻,連線資訊中有INSTANCE_NAME=GOBO4B的連線資訊,而節點bo2dbp上也有一條類似的資訊,因此該條連線
- #日誌是由節點bo2dbp轉發過來而建立的連線請求。
- #同樣在12-OCT-2012 12:01:07時刻,節點bo2dbp轉發過來而建立的連線請求。
- #小結一下,
- #對於直接連線,監聽器日誌中將出現establish,且不含有INSTANCE_NAME=GOBO4B 字樣
- #而對於轉發的連線,則轉發節點與接收的節點同時存在連線資訊,轉發節點上存在連線資訊的與普通的連線請求一樣,
- #而接收的節點上存在INSTANCE_NAME=<instance_name> 資訊
- 3、檢查負載均衡結果
- oracle@SZDB:~> grep GOBO4A srv_load_bal.log |wc -l
- 755
- oracle@SZDB:~> grep GOBO4B srv_load_bal.log |wc -l
- 245
- #從上面的日誌檔案中可知總共有755個客戶端連線到了gobo4a,有245各客戶端連線到了gobo4b
- #下面檢視監聽器日誌來獲得連線資訊
- #下面的查詢中在節點bo2dbp上總共有接受了1000個使用者連線
- oracle@bo2dbp:/u01/oracle/db/network/log> grep establish listener_bo2dbp.log |wc -l
- 1000
- #下面的查詢檢視是否有從節點bo2dbs轉發過來的連線,結果為0,說明沒有任何連線請求從bo2dbs轉發過來
- oracle@bo2dbp:/u01/oracle/db/network/log> grep INSTANCE_NAME=GOBO4 listener_bo2dbp.log |wc -l
- 0
- #接下來檢視節點bo2dbs的監聽日誌,可以看出總共接受了245個連線請求
- oracle@bo2dbs:/u01/oracle/db/network/log> grep establish listener_bo2dbs.log |wc -l
- 245
- #下面的過濾情況也表明在節點bo2dbs上的連線是從bo2dbp上轉發的連線,而非客戶端直接到bo2dbs的請求連線
- oracle@bo2dbs:/u01/oracle/db/network/log> grep INSTANCE_NAME=GOBO4 listener_bo2dbs.log |wc -l
- 245
- #從監聽器的日誌檢查可以,測試中的連線全部請求到節點bo2dbp,是由於tnsnames.ora中ADDRESS的第一個IP地址就是bo2dbp的IP
- #因此所有的連線都是請求到bo2dbp,而沒有客戶端發出到bo2dbs的連線請求
- #其次是儘管在bo2dbp有1000個連線請求,而真正建立連線的只有755個,有245轉發到了節點bo2dbs
三、總結
1、伺服器端的負載均衡需要配置remote_listener引數,而該引數的值依賴於tnsnames.ora的連線字串
2、對於基於伺服器端的連線負載均衡,監聽器會根據當前節點、例項上的連線負載情況進行轉發到空閒的例項
3、轉發的依據僅僅是當前節點監聽的連線數量的多少,而非當前例項的過度負載
4、從上面的測試可以得出,各個節點的連線並不算均衡,是相對的均衡,因此應結合客戶端連線負載協同工作
5、對於當前例項的過度負載的情形,應結合配置service方法來實現負載均衡
配置 RAC 負載均衡與故障轉移
Oracle負載均衡主要是指新會話連線到RAC資料庫時,如何判定這個新的連線要連到哪個節點進行工作?通常情況下,負載均衡分為客戶端負載均衡與伺服器端負載均衡。客戶端負載均衡通常是在客戶端的tnsnames.ora中多新增一個連結地址以及LOAD_BALANCE與failover引數。而伺服器
端的負載均衡則相對複雜,下面具體描述伺服器端負載均衡。
一、負載均衡
注意這裡的負載均衡指的是連線的負載均衡,即客戶可以隨機從不同的例項中連線到資料庫
1.配置tnsnames.ora使得該檔案中包含如下全部內容:
2.配置引數檔案remote_listener
- # LISTENERS_DEVDB DEVDB是資料庫名,可以使用netmgr,netca編輯或直接使用Vim建立
- LISTENERS_DEVDB =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.robinson.com)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.robinson.com)(PORT = 1521))
- )
3.需要配置連線描述資訊的兩個IP地址、埠號、以及load_balance子項為yes (主要是load_balance子項)
- SQL> alter system set remote_listener='LISTENERS_DEVDB' scope=both sid='*';
4.檢視偵聽器的狀態,從下面可以看到devdb.robinson.com服務中有兩個例項為其提供服務
- DEVDB =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.robinson.com)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.robinson.com)(PORT = 1521))
- (LOAD_BALANCE = yes)
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = devdb.robinson.com)
- )
- )
5.測試負載均衡
- [oracle@rac2 ~]$ lsnrctl status
- Service "devdb.robinson.com" has 2 instance(s).
- Instance "devdb1", status READY, has 1 handler(s) for this service...
- Instance "devdb2", status READY, has 2 handler(s) for this service...
使用shell指令碼來進行測試負載均衡
二、配置故障轉移
- --編輯TestLoadBalance.sh
- #!/bin/bash
- #Usage: TestLoadBalance devdb 1000
- count=0
- while [ $count -lt $2 ] # Set up a loop control
- do # Begin the loop
- count='expr $count + 1' # Increment the counter
- sqlplus -s usr1/usr1pwd@$1 @TestLoadBalance.sql # Connect instance and execute sql statement
- sleep 1
- done
- --TestLoadBalance.sql 指令碼
- col instance_name format a30
- select instance_name from v$instance;
- --實施測試
- ./TestLoadBalance.sh devdb 1000
- --檢視結果
- SQL> select inst_id,count(1) from gv$instance group by inst_d;
- INST_ID COUNT(1)
- ---------- ----------
- devdb1 446
- devdb2 554
負載均衡是用於實現基於連線的負載均衡,但不能解決節點是否可用,一旦一個節點損壞,已成功連線的客戶端並不能轉移到其他正常服務的
例項中。而故障轉移功能則使得該功能得以實現。可以使用srvctl 和dbca來建立服務。下面使用dbca來建立一個新的服務,客戶端連線到實
例後,對故障實現透明切換。
1.配置故障轉移服務
在節點rac1使用oracle帳戶啟動dbca工具,
a.選擇 Oracle Real Application Clusters database
b.選擇 Services Management
c.叢集資料庫列表:單擊 Next。
d.資料庫服務:單擊 Add。
新增服務:輸入sales。
選擇 devdb1 作為首選例項。
選擇 devdb2 作為可用例項。
TAF 策略:選擇 Basic。
單擊 Finish。
e.資料庫配置助手:單擊 No 退出。
配置完畢後,在tnsnames.ora中多出了以下內容,注意是各個節點都會多出以下內容
同時引數service_names會多出一個服務名,位於在配置資料庫服務時選擇的首選例項中
- SALES =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.robinson.com)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.robinson.com)(PORT = 1521))
- (LOAD_BALANCE = yes)
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = sales.robinson.com)
- (FAILOVER = --failover_mode是實現故障轉移的關鍵選項
- (TYPE = SELECT)
- (METHOD = BASIC) --TAF 策略:此處當前為 Basic
- (RETRIES = 180)
- (DELAY = 5)
- )
- )
- )
使用srvctl工具也可以看到該服務已經正常開始提供服務
- SQL> select instance_name from v$instance;
- INSTANCE_NAME
- ----------------
- devdb1
- SQL> show parameter service_names
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- service_names string devdb.robinson.com, sales
- SQL> select instance_name from v$instance;
- INSTANCE_NAME
- ----------------
- devdb2
- SQL> show parameter service
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- service_names string devdb.robinson.com
2.實現故障轉移
- SQL> ho srvctl status service -d devdb -s sales
- Service sales is running on instance(s) devdb1
- SQL> ho lsnrctl status
- Service "sales.robinson.com" has 1 instance(s). --sales正常提供服務
- Instance "devdb1", status READY, has 2 handler(s) for this service...
下面使用帳戶usr1,服務名sales從Windows客戶端來登陸,注意要配置好客戶端tnsnames,可以將伺服器sales項內容全部複製到客戶端tnsnames.ora中
3.重新定位故障轉移服務到首選例項
- C:\>sqlplus usr1/usr1@sales
- SQL> col host_name format a20
- SQL> select instance_number ins_no,instance_name,host_name,status from v$instance;
- INS_NO INSTANCE_NAME HOST_NAME STATUS
- ---------- ---------------- -------------------- ------------
- 1 devdb1 rac1.robinson.com OPEN
- SQL> select failover_type,failover_method,failed_over from v$session
- 2 where username='USR1';
- FAILOVER_TYPE FAILOVER_M FAI
- ------------- ---------- ---
- SELECT BASIC NO
- --從其它會話使用sys帳戶登陸到crm 並關閉該例項
- SQL> show user;
- USER is "SYS"
- SQL> select instance_name from v$instance;
- INSTANCE_NAME
- ----------------
- devdb1
- SQL> shutdown abort
- ORACLE instance shut down.
- --從先前登陸到sales的會話中驗證會話故障切換功能
- SQL> select instance_number ins_no,instance_name,host_name,status from v$instance;
- INS_NO INSTANCE_NAME HOST_NAME STATUS
- ---------- ---------------- -------------------- ------------
- 2 devdb2 rac2.robinson.com OPEN
- SQL> select failover_type,failover_method,failed_over from v$session
- 2 where username='USR1'; --第3列顯示的為yes,也表明經過故障切換後提供的服務
- FAILOVER_TYPE FAILOVER_M FAI
- ------------- ---------- ---
- SELECT BASIC YES
- --由下面的查詢中可以看到服務名sales被新增到可用例項devdb2,節點rac2 的service_names引數中
- SQL> select instance_name from v$instance;
- INSTANCE_NAME
- ----------------
- devdb2
- SQL> show parameter service
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- service_names string devdb.robinson.com, sales
對於首選例項從故障中恢復後,需要手動來重新定位到首選例項
4.DML故障轉移(不同於DQL,因此單獨列出)
- SQL> startup --啟動devdb1
- SQL> show parameter service_names
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- service_names string devdb.robinson.com
- SQL> ho srvctl relocate service -d devdb -s sales -i devdb2 -t devdb1
- SQL> show parameter service_names
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- service_names string devdb.robinson.com, sales
使用Windows客戶端透過sales服務名登陸
從另一個會話中使用sysdba關閉devdb1(shutdown abort)
- C:\>sqlplus usr1/usr1@sales
- SQL> show user;
- USER is "USR1"
- SQL> create table tb_temp (id int,ename varchar2(20)) tablespace tbs1;
- Table created.
- SQL> insert into tb_temp
- 2 select 1,'Robinson' from dual
- 3 union all
- 4 select 2,'Jackson' from dual;
- 2 rows created.
- SQL> commit;
- Commit complete.
- SQL> select * from tb_temp;
- ID ENAME
- ---------- --------------------
- 1 Robinson
- 2 Jackson
- SQL> delete from tb_temp;
- 2 rows deleted.
- SQL> select * from tb_temp;
- no rows selected
再在剛剛執行表建立的會話中查詢記錄,收到提示,事務必須被回滾
總結:對於DML 操作在實現故障轉移時,將嚴格按照ACID原則來執行,大部分情況需要回滾事務。
- SQL> select * from tb_temp;
- select * from tb_temp
- *
- ERROR at line 1:
- ORA-25402: transaction must roll back
- SQL> rollback;
- Rollback complete.
- SQL> select * from tb_temp;
- ID ENAME
- ---------- --------------------
- 1 Robinson
- 2 Jackson
- SQL> select failover_type,failover_method,failed_over from v$session
- 2 where username='USR1';
- FAILOVER_TYPE FAILOVER_M FAI
- ------------- ---------- ---
- SELECT BASIC YES
TAF配置
11g RAC環境下客戶端配置TAF
TAF是Transparent Application Failover的英文縮寫,顧名思義就是對應用透明的故障轉移,舉個例子,當應用連線某個oracle資料庫的執行查詢操作的時候,資料庫伺服器網路中斷或者例項崩潰,在經過delay引數設定的值之後,將自動連線到其他可用的例項,繼續進行查詢。(前提是執行計劃,輸出結果集和輸出的順序不能發生變化)
TAF的特性:
1:TAF是ORACLE客戶端提供的一項特性,使用TAF,對客戶端的環境有一定的要求,比如JAVA的JDBC驅動、Oracle客戶端的版本等(8i開始支援TAF);
2:大致上TAF可以分為2種,連線時的TAF和會話建立後TAF;
3:TAF本身與是否RAC環境無關,但一般都用在RAC環境,最小程度的減少最應用的影響,單例項環境下也可以使用TAF,這樣使用PL/SQL developer連線資料庫,即使資料庫例項重啟,也不需要重新連線;
4:RAC環境下,還可以把TAF配置在伺服器端;
5:配置listener.ora檔案的GLOBAL_DBNAME引數後將會禁用TAF。
配置如下:
1、檢視服務端的service_name 和 RAC SCAN地址:
[oracle@rac122 tnslsnr]$ cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 #Public 10.1.252.121 rac121 10.1.252.122 rac122 #Private 192.168.123.1 rac121-priv 192.168.123.2 rac122-priv #Virtual IP 10.1.252.75 rac121-vip 10.1.252.76 rac122-vip 10.1.252.68 rac-scan [oracle@rac122 tnslsnr]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Tue Jun 26 15:33:29 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> show parameter service_name NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ service_names string racdb SQL>
2、在客戶端tnsnames.ora檔案中新增如下內容:
racdb = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.252.68)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = racdb) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 180) (DELAY = 5)) ) )
屬性說明 :
TYPE type屬性描述了故障轉移的型別,可能的值如下:
SESSION 指定發生故障轉換時,TAF應建立會話,不執行其他任何操作。
SELECT 指定執行故障轉換時,除了建立會話,TAF 也應該重新啟動故障轉移期間執行的任何SELECT語句,
當SELECT 語句執行時,ORACLE Net 將返回故障轉移前沒有返回給使用者的行。
NONE 不執行TAF故障轉移
METHOD method特徵確定何時建立會話,可能的值如下 :
BASIC 在故障轉移期間建立會話
PRECONNECT 與資料庫的初始連線建立後,採用由BACKUP 特性指定的ORACLE Net別名建立故障轉移會話。
RETRIES retries特性指Oracle Net 返回ADDRESS_LIST 並嘗試連線到倖存例項的次數。
DELAY delay特性指定每次重試之間等待的次數
3、用客戶端登入作如下操作:
C:\Documents and Settings\```>sqlplus /nolog SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 6月 26 15:00:56 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. SQL> conn sys/system@racdb as sysdba 已連線。 SQL> show parameter instance_name NAME TYPE VALUE ------------------------- ---------------------- --------------- instance_name string racdb2 SQL> select sid from v$mystat where rownum=1; SID ---------- 163 SQL> select machine,failover_type,failover_method,failed_over from v$session where sid=163; MACHINE FAILOVER_TYPE FAILOVER_METHOD FAILED ---------------- ---------- -------------------- ------ AILK\TANWEI SELECT BASIC NO SQL> create table taf_client_test(id int,vname varchar2(10)); 表已建立。 SQL> insert into taf_client_test values(1,'taf'); 已建立 1 行。 SQL> update taf_client_test set id=5; 已更新 1 行。 SQL> select * from taf_client_test; ID VNAME ---------- -------------------- 5 taf
4、更新完畢不commit,停掉racdb2例項:
[oracle@rac122 tnslsnr]$ srvctl status instance -d racdb -i racdb2 Instance racdb2 is running on node rac122 [oracle@rac122 tnslsnr]$ srvctl stop instance -d racdb -i racdb2 -o abort [oracle@rac122 tnslsnr]$ srvctl status instance -d racdb -i racdb2 Instance racdb2 is not running on node rac122 [oracle@rac122 tnslsnr]$ srvctl status instance -d racdb -i racdb1 Instance racdb1 is running on node rac121 --還有一個節點在工作
5、回到客戶端作如下操作:
SQL> select * from taf_client_test; select * from taf_client_test * 第 1 行出現錯誤: ORA-25402: 事務處理必須重新執行 SQL> rollback; 回退已完成。 SQL> select instance_name from v$instance; INSTANCE_NAME -------------------------------- racdb1 SQL> show parameter instance_name NAME TYPE VALUE ---------------- ------------- ----------- instance_name string racdb1 --發現自動切換到節點1, SQL> select * from taf_client_test; 未選定行 SQL> select * from v$mystat where rownum=1; SID STATISTIC# VALUE ---------- ---------- ---------- 166 0 0 SQL> select failover_type,failover_method,failed_over from v$session where sid=166; FAILOVER_TYPE FAILOVER_METHOD FAILED -------------------------- -------------------- ------ SELECT BASIC YES
如何在RAC伺服器端配置TAF
服務端TAF配置會覆蓋客戶端TNS連線串中配置的TAF。如果客戶端沒有配置TAF,在最小配置模式,failover型別必須設定為啟用TAF。如果failover type是在服務端設定,那麼faliover method預設為BASIC。DELAY和RETRIES引數是可選的,可分別指定。
1在RAC上新增一個service注意:service name是唯一的,並且不能與預設建立服務名一致。預設情況下,Oracle RAC資料庫會建立一個特殊的資料庫服務。這個預設的服務在RAC環境中對所有例項總是可用,除非例項在限制模式。並且,DBA不能修改這個預設的服務及其屬性。
新增service的語法:
srvctl add service -d orcl -s taf_orcl.oracle.com -r "orcl1,orcl2" -P BASIC
注:引數-d:資料庫名;-s:服務名;-r:首選例項名;-P:TAF策略
2啟動servicesrvctl start service -d orcl -s taf_orcl.oracle.com
3檢查service執行狀態srvctl config service -d orcl
4獲取建立的service_idselect name,service_id from dba_services where name = 'taf_orcl.oracle.com';
5檢查service的標準配置
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 = X
注意:預設情況下,method,type,retries是沒有值的,這些值對於服務端的TAF是必須的。這是由於srvctl命令新增服務時,沒有修改DBMS_SERVICE引數,在11.2之後,該bug解決。
6新增failover引數--11.2之前:
SQL> execute dbms_service.modify_service (service_name => 'taf_orcl.oracle.com' -
, 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.
注:由於TAF的method為BASIC,BASIC是當前支援的唯一值,不再支援PRECONNECT。
--11.2開始:
srvctl add service -d db_unique_name -s service_name -t edition_name{-r preferred_list [-a available_list]} | {-g server_pool[-c {UNIFORM | SINGLETON}] [-k net_number]}
[-P {BASIC | NONE}] [-l {[PRIMARY] | [PHYSICAL_STANDBY] | [LOGICAL_STANDBY] |
[SNAPSHOT_STANDBY]}] [-y {AUTOMATIC | MANUAL}] [-q {TRUE | FALSE}]
[-x {TRUE | FALSE}] [-j {SHORT | LONG}] [-B {NONE | SERVICE_TIME | THROUGHPUT}]
[-e {NONE |SESSION | SELECT}] [-m {NONE | BASIC}] [-z failover_retries]
[-w failover_delay]
7檢查service及method、retriesSQL>select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications
from dba_services where service_id = X
8檢查監聽是否已註冊新建立的service
lsnrctl services
當然,還可以透過DBCA或者Oracle OEM來配置RAC Server。本文不再詳述。
配置Server Side TAF
實驗環境:Oracle 11.2.0.4 RAC
參考MOS文件:
How To Configure Server Side Transparent Application Failover (文件 ID 460982.1)
- 1.為設定TAF在RAC叢集上新建服務
- 2.啟動server_taf服務
- 3.檢查確認服務正在執行
- 4.找到剛建立服務的service_id
- 5.根據service_id審查服務的資訊
- 6.給服務新增server side failover引數
- 7.再次審查服務可以看到Method, Type和Retries值
- 8.檢查已註冊的服務的監聽資訊
- 9.建立網路服務名
- 10.測試TAF功能
1.為設定TAF在RAC叢集上新建服務
eg: srvctl add service -d rac -s server_taf -r "rac1,rac2" -P BASIC
使用oracle使用者在RAC叢集上新建服務server_taf:
[oracle@jyrac1 ~]$ srvctl add service -d jyzhao -s server_taf -r "jyzhao1,jyzhao2" -P BASIC
[oracle@jyrac1 ~]$
注意不能使用grid使用者操作,如果使用grid 使用者執行的話,會報錯:
[grid@jyrac1 ~]$ srvctl add service -d jyzhao -s server_taf -r "jyzhao1,jyzhao2" -P BASIC
PRCD-1288 : User is not authorized to create service server_taf for database jyzhao
PRKH-1014 : Current user "grid" is not the oracle owner user "oracle" of oracle home "/opt/app/oracle/product/11.2.0/dbhome_1"
2.啟動server_taf服務
eg: srvctl start service -d rac -s server_taf
啟動server_taf服務
[oracle@jyrac1 ~]$ srvctl start service -d jyzhao -s server_taf
3.檢查確認服務正在執行
eg: srvctl config service -d rac
檢查確認服務正在執行:
[oracle@jyrac1 ~]$ srvctl config service -d jyzhao
Service name: server_taf
Service is enabled
Server pool: jyzhao_server_taf 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: jyzhao1,jyzhao2
Available instances:
4.找到剛建立服務的service_id
eg: select name,service_id from dba_services where name = 'server_taf';
找到剛建立服務的service_id
SQL> select name,service_id from dba_services where name = 'server_taf'; NAME SERVICE_ID
---------------------------------------------------------------- ----------
server_taf 7
5.根據service_id審查服務的資訊
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'
select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications
from dba_services where service_id = 7;
根據service_id審查服務的資訊:
SQL> col name format a15
SQL> col failover_method format a11 heading 'METHOD' SQL> col failover_type format a10 heading 'TYPE' SQL> col failover_retries format 9999999 heading 'RETRIES' SQL> col goal format a10
SQL> col clb_goal format a8
SQL> col AQ_HA_NOTIFICATIONS format a5 heading 'AQNOT' SQL> select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications 2 from dba_services where service_id = 7 3 ; NAME METHOD TYPE RETRIES GOAL CLB_GOAL AQNOT
--------------- ----------- ---------- -------- ---------- -------- -----
server_taf NONE NONE 0 NONE LONG NO
SQL>
6.給服務新增server side failover引數
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);
11.2版本可以使用srvctl 修改服務的資訊:
srvctl modify service -d RAC -s server_taf -m BASIC -e SELECT -q TRUE -j LONG
給服務新增server side failover引數:
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.
7.再次審查服務可以看到Method, Type和Retries值
select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications
from dba_services where service_id = 7;
再次審查服務可以看到Method, Type和Retries值:
SQL> select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications 2 from dba_services where service_id = 7; NAME METHOD TYPE RETRIES GOAL CLB_GOAL AQNOT
--------------- ----------- ---------- -------- ---------- -------- -----
server_taf BASIC SELECT 180 NONE LONG YES
8.檢查已註冊的服務的監聽資訊
lsnrctl services
Service "server_taf.za.oracle.com" has 2 instance(s).
Instance "rac1", status READY, has 2 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=dell01)(PORT=1521))
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Instance "rac2", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=dell02)(PORT=1521))
我這裡版本差異,顯示有區別,分別在不同節點顯示自己的例項:
--node1: Service "server_taf" has 1 instance(s).
Instance "jyzhao1", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER The command completed successfully --node2: Service "server_taf" has 1 instance(s). Instance "jyzhao2", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER The command completed successfully
9.建立網路服務名
SERVERTAF =
(DESCRIPTION =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = dell01)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = dell02)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = server_taf.za.oracle.com)
)
)
服務端RAC所有節點配置tnsnames.ora,新增內容:
SERVERTAF =
(DESCRIPTION =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = jyrac1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = jyrac2)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = server_taf)
)
)
sqlplus system/oracle@192.168.56.160/server_taf
10.測試TAF功能
select host_name,instance_name from v$instance;
SQL> select instance_name from V$instance;
INSTANCE_NAME
----------------
rac2
SQL> shutdown abort;
ORACLE instance shut down.
select host_name,instance_name from v$instance;
10.1 模擬客戶端使用scanVIP測試能否實現TAF
sqlplus system/oracle@192.168.56.160/server_taf
[grid@jyrac1 ~]$ sqlplus system/oracle@192.168.56.160/server_taf
SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 10 02:59:53 2017 Copyright (c) 1982, 2013, 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
SQL> select host_name,instance_name from v$instance;
HOST_NAME ---------------------------------------------------------------- INSTANCE_NAME ---------------- jyrac1
jyzhao1 --這裡強制關掉jyzhao1例項。 SQL> /
HOST_NAME ---------------------------------------------------------------- INSTANCE_NAME ---------------- jyrac2
jyzhao2
10.1 結論: 可以實現TAF功能,相當於客戶端不再需要配置,直接透過SCAN VIP連線。
10.2 模擬客戶端使用Public IP測試能否實現TAF
sqlplus system/oracle@192.168.56.150/server_taf
SQL> select host_name,instance_name from v$instance;
HOST_NAME ---------------------------------------------------------------- INSTANCE_NAME ---------------- jyrac1
jyzhao1 --這裡強制關掉jyzhao1例項。 SQL> / select host_name,instance_name from v$instance
*
ERROR at line 1:
ORA-12153: TNS:not connected
Process ID: 20116 Session ID: 24 Serial number: 7
如果客戶端配置tnsnames.ora,將publicIP配置
TAF =
(DESCRIPTION =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.150)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.152)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = server_taf)
)
)
再次測試:
[oracle@jyrac2 admin]$ sqlplus system/oracle@taf
SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 10 05:11:30 2017 Copyright (c) 1982, 2013, 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
SQL> select host_name,instance_name from v$instance;
HOST_NAME ---------------------------------------------------------------- INSTANCE_NAME ---------------- jyrac2
jyzhao2 --這裡強制關掉jyzhao2例項。 SQL> /
HOST_NAME ---------------------------------------------------------------- INSTANCE_NAME ---------------- jyrac1
jyzhao1
10.2 結論: 直接連線Public IP無法實現TAF功能。但客戶端配置Public IP列表,可以實現。
10.3 模擬客戶端使用VIP測試能否實現TAF
sqlplus system/oracle@192.168.56.151/server_taf
[grid@jyrac1 ~]$ sqlplus system/oracle@192.168.56.151/server_taf
SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 10 04:32:20 2017 Copyright (c) 1982, 2013, 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
SQL> select host_name,instance_name from v$instance;
HOST_NAME
----------------------------------------------------------------
INSTANCE_NAME
----------------
jyrac1
jyzhao1
SQL> / select host_name,instance_name from v$instance
* ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 32459 Session ID: 159 Serial number: 3
如果客戶端配置tnsnames.ora,可以透過sqlplus 。
TAFVIP =
(DESCRIPTION =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.151)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.153)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = server_taf)
)
)
再次測試:
[oracle@jyrac2 admin]$ sqlplus system/oracle@tafvip
SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 10 05:15:32 2017 Copyright (c) 1982, 2013, 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
SQL> select host_name,instance_name from v$instance;
HOST_NAME ---------------------------------------------------------------- INSTANCE_NAME ---------------- jyrac2
jyzhao2 --這裡強制關掉jyzhao2例項。 SQL> /
HOST_NAME ---------------------------------------------------------------- INSTANCE_NAME ---------------- jyrac1
jyzhao1
10.3 結論: 直接連線VIP無法實現TAF功能。但客戶端配置VIP列表,可以實現。
官方文件:
About Transparent Application Failover
TAF is a client-side feature that allows clients to reconnect to surviving databases in the event of a failure of a database instance. Notifications are used by the server to trigger TAF callbacks on the client-side.
TAF is configured using either client-side specified Transparent Network Substrate (TNS) connect string or using server-side service attributes. If both methods are used to configure TAF, then the server-side service attributes supersede the client-side settings. Server-side service attributes are the preferred way to set up TAF.
TAF can operate in one of two modes, Session Failover and Select Failover. Session Failover re-creates lost connections and sessions. Select Failover replays queries that were in progress.
When there is a failure, callback functions are initiated on the client-side using Oracle Call Interface (OCI) callbacks. This works with standard OCI connections as well as Connection Pool and Session Pool connections.
TAF operates with Oracle Data Guard to provide automatic failover. TAF works with the following database configurations to effectively mask a database failure:
-
Oracle Real Application Clusters
-
Replicated systems
-
Standby databases
-
Single instance Oracle database
See Also:
-
Oracle Real Application Clusters Installation and Configuration Guide
-
-
Oracle Call Interface Programmer's Guide for more details on callbacks, connection pools, and session pools
What Transparent Application Failover Restores
TAF automatically restores some or all of the following elements associated with active database connections. Other elements may need to be embedded in the application code to enable TAF to recover the connection.
-
Client-server database connections: TAF automatically reestablishes the connection using the same connect string or an alternate connect string that you specify when configuring failover.
-
Users' database sessions: TAF automatically logs a user in with the same user ID as was used before the failure. If multiple users were using the connection, then TAF automatically logs them in as they attempt to process database commands. Unfortunately, TAF cannot automatically restore other session properties. These properties can be restored by invoking a callback function.
-
Completed commands: If a command was completed at the time of connection failure, and it changed the state of the database, then TAF does not resend the command. If TAF reconnects in response to a command that may have changed the database, then TAF issues an error message to the application.
-
Open cursors used for fetching: TAF allows applications that began fetching rows from a cursor before failover to continue fetching rows after failover. This is called select failover. It is accomplished by re-running a SELECT statement using the same snapshot, discarding those rows already fetched and retrieving those rows that were not fetched initially. TAF verifies that the discarded rows are those that were returned initially, or it returns an error message.
-
Active transactions: Any active transactions are rolled back at the time of failure because TAF cannot preserve active transactions after failover. The application instead receives an error message until a ROLLBACK is submitted.
-
Server-side program variables: Server-side program variables, such as PL/SQL package states, are lost during failures, and TAF cannot recover them. They can be initialized by making a call from the failover callback.
See Also:
Oracle Call Interface Programmer's GuideAbout FAILOVER_MODE Parameters
The FAILOVER_MODE parameter must be included in the CONNECT_DATA section of a connect descriptor. FAILOVER_MODE can contain the parameters described in .
Table 13-4 Additional Parameters of the FAILOVER_MODE Parameter
FAILOVER_MODE Parameters | Description |
---|---|
BACKUP |
A different net service name for backup connections. A backup should be specified when usingpreconnect to pre-establish connections. |
DELAY |
The amount of time in seconds to wait between connect attempts. If RETRIES is specified, thenDELAY defaults to one second. If a callback function is registered, then this parameter is ignored. |
METHOD |
Setting for fast failover from the primary node to the backup node:
|
RETRIES |
The number of times to attempt to connect after a failover. If DELAY is specified, then RETRIESdefaults to five retry attempts. If a callback function is registered, then this parameter is ignored. |
TYPE |
The type of failover. Three types of Oracle Net failover functionality are available by default to Oracle Call Interface (OCI) applications:
|
Note:
Oracle Net Manager does not provide support for TAF parameters. These parameters must be set manually.Implementing Transparent Application Failover
Important:
Do not set the GLOBAL_DBNAME parameter in the SID_LIST_listener_name section of the listener.ora file. A statically configured global database name disables TAF.Depending on the FAILOVER_MODE parameters, you can implement TAF in several ways. Oracle recommends the following methods:
TAF with Connect-Time Failover and Client Load Balancing
Implement TAF with connect-time failover and client load balancing for multiple addresses. In the following example, Oracle Net connects randomly to one of the protocol addresses on sales1-serveror sales2-server. If the instance fails after the connection, then the TAF application fails over to the other node's listener, reserving any SELECT statements in progress.
sales.us.example.com= (DESCRIPTION= (LOAD_BALANCE=on) (FAILOVER=on) (ADDRESS= (PROTOCOL=tcp) (HOST=sales1-server) (PORT=1521)) (ADDRESS= (PROTOCOL=tcp) (HOST=sales2-server) (PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=sales.us.example.com) (FAILOVER_MODE= (TYPE=select) (METHOD=basic))))
TAF Retrying a Connection
TAF also provides the ability to automatically retry connecting if the first connection attempt fails with the RETRIES and DELAY parameters. In the following example, Oracle Net tries to reconnect to the listener on sales1-server. If the failover connection fails, then Oracle Net waits 15 seconds before trying to reconnect again. Oracle Net attempts to reconnect up to 20 times.
sales.us.example.com= (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=sales1-server) (PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=sales.us.example.com) (FAILOVER_MODE= (TYPE=select) (METHOD=basic) (RETRIES=20) (DELAY=15))))
TAF Pre-establishing a Connection
A backup connection can be pre-established. The initial and backup connections must be explicitly specified. In the following example, clients that use net service name sales1.us.example.com to connect to the listener on sales1-server are also preconnected to sales2-server. If sales1-server fails after the connection, then Oracle Net fails over to sales2-server, preserving anySELECT statements in progress. Similarly, Oracle Net preconnects to sales1-server for those clients that use sales2.us.example.com to connect to the listener on sales2-server.
sales1.us.example.com= (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=sales1-server) (PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=sales.us.example.com) (INSTANCE_NAME=sales1) (FAILOVER_MODE= (BACKUP=sales2.us.example.com) (TYPE=select) (METHOD=preconnect)))) sales2.us.example.com= (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=sales2-server) (PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=sales.us.example.com) (INSTANCE_NAME=sales2) (FAILOVER_MODE= (BACKUP=sales1.us.example.com) (TYPE=select) (METHOD=preconnect))))
Verifying Transparent Application Failover
You can query the FAILOVER_TYPE, FAILOVER_METHOD, and FAILED_OVER columns in the V$SESSION view to verify that TAF is correctly configured. To view the columns, use a query similar to the following:
SELECT MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER, COUNT(*) FROM V$SESSION GROUP BY MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER;
The output before failover looks similar to the following:
MACHINE FAILOVER_TYPE FAILOVER_M FAI COUNT(*) -------------------- ------------- ---------- --- ---------- sales1 NONE NONE NO 11 sales2 SELECT PRECONNECT NO 1
The output after failover looks similar to the following:
MACHINE FAILOVER_TYPE FAILOVER_M FAI COUNT(*) -------------------- ------------- ---------- --- ---------- sales2 NONE NONE NO 10 sales2 SELECT PRECONNECT YES 1
Note:
You can monitor each step of TAF using an appropriately configured OCI TAF CALLBACK function.See Also:
-
for additional information about the V$SESSION view
Oracle RAC failover 測試(Server TAF方式)
Oracle RAC中,除了基於客戶端的TAF方式之外,還有基於伺服器端的TAF方式,可以把服務端的TAF方式看作是客戶端TAF方式的一個升級版吧。伺服器端的TAF,當然是需要在伺服器端進行配置了,這個是透過Service來完成的。本文主要描述Oracle 10g rac 下透過service方式配置伺服器端的TAF。
下面是一些關於這方面的基礎參考連結:
有關負監聽配置,載均衡(load balance)請參考
ORACLE RAC 監聽配置 (listener.ora tnsnames.ora)
ORACLE RAC 下非預設埠監聽配置(listener.ora tnsnames.ora)
Oracle RAC 客戶端連線負載均衡(Load Balance)
Oracle RAC 伺服器端連線負載均衡(Load Balance)
Oracle RAC 負載均衡測試(結合伺服器端與客戶端)
有關Oracle RAC failover 連線時故障轉移請參考
Oracle RAC failover 測試(連線時故障轉移)
Oracle RAC failover 測試(TAF方式)
有關Services的建立請參考
Services in Oracle Database 10g
再說 Oracle RAC services
- 1、伺服器端、客戶端的環境
- #伺服器端環境,host資訊
- oracle@bo2dbp:~> cat /etc/hosts |grep vip
- 192.168.7.61 bo2dbp-vip.2gotrade.com bo2dbp-vip
- 192.168.7.62 bo2dbs-vip.2gotrade.com bo2dbs-vip
- #伺服器端環境,叢集資訊
- oracle@bo2dbp:~> ./crs_stat.sh
- Resource name Target State
- -------------- ------ -----
- ora.GOBO4.GOBO4A.inst ONLINE ONLINE on bo2dbp
- ora.GOBO4.GOBO4B.inst ONLINE ONLINE on bo2dbs
- ora.GOBO4.db ONLINE ONLINE on bo2dbp
- ora.bo2dbp.ASM1.asm ONLINE ONLINE on bo2dbp
- ora.bo2dbp.LISTENER_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
- ora.bo2dbp.LISTENER_ORA10G_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
- ora.bo2dbp.gsd ONLINE ONLINE on bo2dbp
- ora.bo2dbp.ons ONLINE ONLINE on bo2dbp
- ora.bo2dbp.vip ONLINE ONLINE on bo2dbp
- ora.bo2dbs.ASM2.asm ONLINE ONLINE on bo2dbs
- ora.bo2dbs.LISTENER_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
- ora.bo2dbs.LISTENER_ORA10G_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
- ora.bo2dbs.gsd ONLINE ONLINE on bo2dbs
- ora.bo2dbs.ons ONLINE ONLINE on bo2dbs
- ora.bo2dbs.vip ONLINE ONLINE on bo2dbs
- ora.ora10g.db ONLINE ONLINE on bo2dbp
- #客戶端環境
- robin@SZDB:~> cat /etc/issue
- Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l).
- robin@SZDB:~> sqlplus -v
- SQL*Plus: Release 10.2.0.3.0 - Production
- #客戶端tnsnames配置
- GOBO4 =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
- (LOAD_BALANCE = yes)
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = TAF) #注意我們客戶端的SERVICE_NAME,我們設定為TAF
- )
- )
- 2、在伺服器端配置service
- 配置service有多種方式,如dbca,oem,srvctl命令列。下面直接以命令列方式配置
- 關於什麼是service以及如何使用srvctl命令列建立service,請參考: http://blog.csdn.net/robinson_0612/article/details/8124232
- oracle@bo2dbp:~> srvctl add service -d GOBO4 -s TAF -r GOBO4A -a GOBO4B -P basic
- oracle@bo2dbp:~> srvctl start service -d GOBO4 -s TAF
- oracle@bo2dbp:~> ./crs_stat.sh | grep TAF
- ora.GOBO4.TAF.GOBO4A.srv ONLINE ONLINE on bo2dbp
- ora.GOBO4.TAF.cs ONLINE ONLINE on bo2dbp
- oracle@bo2dbp:~> srvctl config service -d GOBO4 -a
- TAF PREF: GOBO4A AVAIL: GOBO4B TAF: basic
- oracle@bo2dbp:~> export ORACLE_SID=GOBO4A
- oracle@bo2dbp:~> sqlplus / as sysdba
- SQL*Plus: Release 10.2.0.3.0 - Production on Mon Dec 17 14:55:02 2012
- Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
- Connected to:
- Oracle Database 10g Release 10.2.0.3.0 - 64bit Production
- With the Real Application Clusters option
- SQL> show parameter service
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- service_names string SYS$SYS.KUPC$S_1_2012102317304
- 4.GOBO4, SYS$SYS.KUPC$C_1_2012
- 1023173044.GOBO4, GOBO4, TAF
- SQL> begin
- 2 dbms_service.modify_service(
- 3 service_name=>'TAF',
- 4 failover_method =>dbms_service.failover_method_basic,
- 5 failover_type =>dbms_service.failover_type_select,
- 6 failover_retries =>180,
- 7 failover_delay=>5);
- 8 end;
- 9 /
- PL/SQL procedure successfully completed.
- SQL> select name,failover_method,failover_type,goal,clb_goal from dba_services
- 2 where name='TAF';
- NAME FAILOVER_METHOD FAILOVER_TYPE GOAL CLB_G
- -------------------- -------------------- --------------- ------------ -----
- TAF BASIC SELECT LONG
- SQL> ho lsnrctl status
- ..........
- Service "TAF" has 1 instance(s).
- Instance "GOBO4A", status READY, has 2 handler(s) for this service...
- The command completed successfully
- 3、測試伺服器端TAF
- robin@SZDB:~> sqlplus fail_over/fail@gobo4
- fail_over@GOBO4> get verify.sql
- 1 REM the following query is for TAF connection verification
- 2 col sid format 99999
- 3 col serial# format 9999999
- 4 col failover_type format a13
- 5 col failover_method format a15
- 6 col failed_over format a11
- 7 Prompt
- 8 Prompt Failover status for current user
- 9 Prompt ============================================
- 10 SELECT sid,
- 11 serial#,
- 12 failover_type,
- 13 failover_method,
- 14 failed_over
- 15 FROM v$session
- 16 WHERE username = 'FAIL_OVER';
- 17 REM the following query is for load balancing verification
- 18 col host_name format a20
- 19 Prompt
- 20 Prompt Current instance name and host name
- 21 Prompt ========================================
- 22* SELECT instance_name,host_name FROM v$instance;
- 23
- #下面的連線查詢中表明客戶端當前連線到了節點bo2dbp,其例項名為GOBO4A
- fail_over@GOBO4> @verify
- Failover status for current user
- ============================================
- SID SERIAL# FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
- ------ -------- ------------- --------------- -----------
- 1073 48 SELECT BASIC NO
- Current instance name and host name
- ========================================
- INSTANCE_NAME HOST_NAME
- ---------------- --------------------
- GOBO4A bo2dbp
- #此時停止節點bo2dbp
- oracle@bo2dbp:~> srvctl stop instance -d GOBO4 -i GOBO4A
- #檢視停止節點bo2dbp即例項GOBO4A後的結果
- oracle@bo2dbp:~> ./crs_stat.sh |grep inst
- ora.GOBO4.GOBO4A.inst OFFLINE OFFLINE
- ora.GOBO4.GOBO4B.inst ONLINE ONLINE on bo2dbs
- #此時回到客戶端再次執行查詢,FAILED_OVER的值已經變成YES,即表明當前的session為failover過來的
- #同時例項名和節點名也發生了變化
- fail_over@GOBO4> set timing on;
- fail_over@GOBO4> @verify
- Failover status for current user
- ============================================
- SID SERIAL# FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
- ------ -------- ------------- --------------- -----------
- 1082 396 SELECT BASIC YES
- Elapsed: 00:00:04.19
- Current instance name and host name
- ========================================
- INSTANCE_NAME HOST_NAME
- ---------------- --------------------
- GOBO4B bo2dbs
- Elapsed: 00:00:00.01
- 4、小結
- a、伺服器端的TAF方式的failover透過在伺服器端配置service來完成
- b、伺服器端的TAF方式與客戶端的TAF方式產生同樣的效果
- b、一旦在服務端配置了基於伺服器端的TAF,客戶端再無需透過在客戶端新增FAILOVER_MODE項
- c、該方式簡化客戶端配置,透過集中統一管理service實現failover
Oracle RAC 負載均衡測試(結合伺服器端與客戶端)
Oracle RAC 負載均衡使得從客戶端發起的連線能夠有效地分配到監聽器負載較小的例項上。有兩種方式實現客戶端負載均衡,一是透過配置客戶端的load_balance,一是透過配置伺服器端的remote_listener引數。兩種方式各有優劣,而且兩者並不相互排斥,因此可以結合兩種方式來更加有效的實現負載均衡。本文將描述兩者結合的使用情況(oralce 10g rac)。
有關客戶端與服務端負載均衡的單獨測試請參考:
Oracle RAC 客戶端連線負載均衡(Load Balance)
Oracle RAC 伺服器端連線負載均衡(Load Balance)
本文的測試將結合前篇文章使用的指令碼與樣例,是前兩篇測試的一個總結。
一、配置需求
- 1、伺服器端各節點監聽器正常提供服務,如果使用非預設的1521埠,請參考 ORACLE RAC 下非預設埠監聽配置(listener.ora tnsnames.ora)
- oracle@bo2dbp:~> more $ORACLE_HOME/network/admin/listener.ora
- # listener.ora.bo2dbp Network Configuration File: /u01/oracle/db/network/admin/listener.ora.bo2dbp
- # Generated by Oracle configuration tools.
- LISTENER_BO2DBP =
- (DESCRIPTION_LIST =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = bo2dbp-vip.2gotrade.com)(PORT = 1521)(IP = FIRST))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.51)(PORT = 1521)(IP = FIRST))
- )
- )
- SID_LIST_LISTENER_BO2DBP =
- (SID_LIST =
- (SID_DESC =
- (SID_NAME = PLSExtProc)
- (ORACLE_HOME = /u01/oracle/db)
- (PROGRAM = extproc)
- )
- )
- oracle@bo2dbp:~> lsnrctl status
- Service "GOBO4" has 2 instance(s).
- Instance "GOBO4A", status READY, has 2 handler(s) for this service...
- Instance "GOBO4B", status READY, has 1 handler(s) for this service...
- 2、伺服器端的remote_listener引數設定
- 要求remote_listener引數的連線識別符號在伺服器端的tnsnames.ora中有對應的條目
- SQL> show parameter listener
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- local_listener string
- remote_listener string remote_lsnr_gobo4
- oracle@bo2dbp:~> more $ORACLE_HOME/network/admin/tnsnames.ora
- # tnsnames.ora Network Configuration File: /u01/oracle/db/network/admin/tnsnames.ora
- # Generated by Oracle configuration tools.
- remote_lsnr_gobo4 =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
- )
- 3、客戶端tnsnames.ora中啟用load_balance
- oracle@SZDB:~> tail -11 $ORACLE_HOME/network/admin/tnsnames.ora
- GOBO4 =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
- (LOAD_BALANCE = yes)
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = GOBO4)
- )
- )
二、測試Load Balance
- #還是使用之前的腳步來進行測試
- #Author : Robinson
- #Blog : http://blog.csdn.net/robinson_0612
- oracle@SZDB:~> more load_balance.sh
- #!/bin/bash
- for i in {1..1000}
- do
- echo $i
- sqlplus -S system/oracle@GOBO4 <<EOF
- select instance_name from v\$instance;
- EOF
- sleep 1
- done
- exit 0
- oracle@SZDB:~> ./load_balance.sh >load_bal.log
- #檢視日誌
- oracle@SZDB:~> grep GOBO4A load_bal.log |wc -l
- 750
- oracle@SZDB:~> grep GOBO4B load_bal.log |wc -l
- 250
- #檢視監聽器的日誌
- oracle@bo2dbp:/u01/oracle/db/network/log> grep establish listener_bo2dbp.log |wc -l
- 894
- oracle@bo2dbp:/u01/oracle/db/network/log> grep INSTANCE_NAME=GOBO4 listener_bo2dbp.log |wc -l
- 415
- #從上面的查詢中可以得知,節點bo2dbp總共接受了894個連線請求,而有415連線請求是由bo2dbs轉發過來的
- #因此,實際上從客戶端發起到bo2dbp的實際連線請求數為894-415=479
- #下面來看在節點bo2dbs上的監聽日誌
- oracle@bo2dbs:/u01/oracle/db/network/log> grep establish listener_bo2dbs.log |wc -l
- 665
- oracle@bo2dbs:/u01/oracle/db/network/log> grep INSTANCE_NAME=GOBO4 listener_bo2dbs.log |wc -l
- 144
- #從上面的查詢中可知,節點bo2dbs總共接受了665個連線請求,而有144個連線請求是由bo2dbp轉發過來的
- #因此,實際上從客戶端發起到bo2dbs的實際連線請求數為655-144=511
- #從上面的結果可知,
- #基於客戶端的連線請求數為節點bo2dbp為479,節點bo2dbs為511
- #監聽器路由到本地例項數目為,節點bo2dbp,479-144=335,節點bo2dbs,511-415=96
- #遠端監聽器路由道本地例項的資料為,節點bo2dpb為415,節點bo2dbs為144
- #監聽器路由的概念是指基於伺服器端的負載均衡
- #即伺服器端的監聽器根據自身以及遠端監聽器的負載情況來確定將當前的連線請求轉發到本地或遠端,此即為路由。
Oracle RAC failover 測試(連線時故障轉移)
Oracle RAC 叢集最突出的表現就是高可用性,這些內容主要包括load balance以及failover,透過這些技術使得單點故障不影響客戶端端應用程式對資料庫的正常訪問,以及透過建立service實現節點間負載均衡。本文主要描述Oracle 10g rac環境下的Oracle failover測試。
下面是一些關於這方面的基礎參考或相關連結:
有關負監聽配置,載均衡(load balance)以及Oracle service請參考
ORACLE RAC 監聽配置 (listener.ora tnsnames.ora)
ORACLE RAC 下非預設埠監聽配置(listener.ora tnsnames.ora)
Oracle RAC 客戶端連線負載均衡(Load Balance)
Oracle RAC 伺服器端連線負載均衡(Load Balance)
Oracle RAC 負載均衡測試(結合伺服器端與客戶端)
Oracle RAC failover 測試(TAF方式)
Oracle RAC failover 測試(Server TAF方式)
- 1、Oracle failover的幾種方式
- Oracle failover也叫故障轉移,從Oracle 10g開始,分為3種方式:
- a. Client-Side Connect time Failover
- 客戶端連線failover模式,此方式較為簡單,只要安裝了rac叢集,預設情況下即被啟用。
- b. TAF
- 透明故障轉移,此方式同樣基於客戶端完成,需要配置客戶端tnsnames.ora,連線故障發生時,無須重新連線
- c. Service-Side TAF
- 伺服器端透明故障轉移,透過配置service來實現,客戶端無須任何配置。
- 本文主要演示第一種情形,即客戶端在發起連線請求時如何實現故障轉移
- 注意事項: 不能在listener.ora 檔案中設定GLOBAL_NAME
- 該引數會禁用Connect-time Failover 和 Transparent Application Failover
- 2、Client-Side Connect time Failover
- 下面關於Client-Side Connect time Failover來自Oracle 的官方描述 ID 453293.1
- The connect-time failover enables clients to connect to another listener if the initial connection to the first
- listener fails. The number of listener protocol addresses determines how many listeners are tried. Without
- connect-time failover, Oracle Net attempts a connection with only one listener. The default is on.
- Tnsnames Parameter: FAILOVER
- (failover=on) is default for ADDRESS_LISTs, DESCRIPTION_LISTs, and a set of
- DESCRIPTIONs., therefore, you do not have to specify it explicitly.
- 基於客戶端的failover比較好理解。對於在客戶端tnsnames.ora有多個VIP的情形,客戶端會首先請求定位到第一個VIP,如果第一個VIP不
- 可達,則繼續嘗試使用下一個VIP,直到成功建立連線,如果所有的VIP無法連線將收到錯誤訊息。
- 通常情況下,我們使用vip作為tnsnames.ora中的連線地址
- 3、伺服器端、客戶端的環境
- #伺服器端環境,host資訊
- oracle@bo2dbp:~> cat /etc/hosts |grep vip
- 192.168.7.61 bo2dbp-vip.2gotrade.com bo2dbp-vip
- 192.168.7.62 bo2dbs-vip.2gotrade.com bo2dbs-vip
- #伺服器端環境,叢集資訊
- oracle@bo2dbp:~> ./crs_stat.sh
- Resource name Target State
- -------------- ------ -----
- ora.GOBO4.GOBO4A.inst ONLINE ONLINE on bo2dbp
- ora.GOBO4.GOBO4B.inst ONLINE ONLINE on bo2dbs
- ora.GOBO4.db ONLINE ONLINE on bo2dbp
- ora.bo2dbp.ASM1.asm ONLINE ONLINE on bo2dbp
- ora.bo2dbp.LISTENER_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
- ora.bo2dbp.LISTENER_ORA10G_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
- ora.bo2dbp.gsd ONLINE ONLINE on bo2dbp
- ora.bo2dbp.ons ONLINE ONLINE on bo2dbp
- ora.bo2dbp.vip ONLINE ONLINE on bo2dbp
- ora.bo2dbs.ASM2.asm ONLINE ONLINE on bo2dbs
- ora.bo2dbs.LISTENER_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
- ora.bo2dbs.LISTENER_ORA10G_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
- ora.bo2dbs.gsd ONLINE ONLINE on bo2dbs
- ora.bo2dbs.ons ONLINE ONLINE on bo2dbs
- ora.bo2dbs.vip ONLINE ONLINE on bo2dbs
- ora.ora10g.db ONLINE ONLINE on bo2dbp
- #客戶端環境
- robin@SZDB:~> cat /etc/issue
- Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l).
- robin@SZDB:~> sqlplus -v
- SQL*Plus: Release 10.2.0.3.0 - Production
- #客戶端tnsnames配置
- GOBO4 =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
- (LOAD_BALANCE = yes)
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = GOBO4)
- )
- )
- 4、連線測試
- #首次建立連線,此時客戶端從tnsnames配置的第一個IP建立連線,即192.168.7.61
- #VIP 192.168.7.61對應的hostname以及instance_name分別為bo2dbp,GOBO4A,所以我們獲得如下返回結果
- robin@SZDB:~> sqlplus fail_over/fail@gobo4
- fail_over@GOBO4> get verify.sql
- 1 REM the following query is for TAF connection verification
- 2 col sid format 99999
- 3 col serial# format 9999999
- 4 col failover_type format a13
- 5 col failover_method format a15
- 6 col failed_over format a11
- 7 Prompt
- 8 Prompt Failover status for current user
- 9 Prompt ============================================
- 10 SELECT sid,
- 11 serial#,
- 12 failover_type,
- 13 failover_method,
- 14 failed_over
- 15 FROM v$session
- 16 WHERE username = 'FAIL_OVER';
- 17 REM the following query is for load balancing verification
- 18 col host_name format a20
- 19 Prompt
- 20 Prompt Current instance name and host name
- 21 Prompt ========================================
- 22* SELECT instance_name,host_name FROM v$instance;
- 23
- fail_over@GOBO4> @verify.sql
- Failover status for current user
- ============================================
- SID SERIAL# FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
- ------ -------- ------------- --------------- -----------
- 1071 249 NONE NONE NO
- Current instance name and host name
- ========================================
- INSTANCE_NAME HOST_NAME
- ---------------- --------------------
- GOBO4A bo2dbp
- #停止叢集資料庫的第一個instance,即GOBO4A
- oracle@bo2dbp:~> srvctl stop instance -d GOBO4 -i GOBO4A
- #校驗結果
- oracle@bo2dbp:~> ./crs_stat.sh | grep inst
- ora.GOBO4.GOBO4A.inst OFFLINE OFFLINE
- ora.GOBO4.GOBO4B.inst ONLINE ONLINE on bo2dbs
- #回到客戶端原來的session,此時出現ORA-03114
- fail_over@GOBO4> /
- SELECT instance_name,host_name FROM v$instance
- *
- ERROR at line 1:
- ORA-03113: end-of-file on communication channel
- fail_over@GOBO4> /
- ERROR:
- ORA-03114: not connected to ORACLE
- ERROR:
- ORA-03114: not connected to ORACLE
- #下面嘗試重新建立連線
- fail_over@GOBO4> conn fail_over/fail@gobo4
- Connected.
- fail_over@GOBO4> @verify
- Failover status for current user
- ============================================
- SID SERIAL# FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
- ------ -------- ------------- --------------- -----------
- 1062 94 NONE NONE NO
- Current instance name and host name
- ========================================
- INSTANCE_NAME HOST_NAME
- ---------------- --------------------
- GOBO4B bo2dbs
- #Author : Robinson
- #Blog : http://blog.csdn.net/robinson_0612
- #從上面的查詢可知,當前的session已經連線到第二個例項。且FAILOVER_TYPE,FAILOVER_METHOD,FAILED_OVER幾個至沒有發生任何變化
- #因為這幾個引數主要是針對TAF。
- 5、小結
- a、客戶端連線時的故障轉移,伺服器端和客戶端無需任何配置,預設情況下即被開啟,即failover=on
- b、只要叢集環境存在(非單節點RAC),客戶端的連線請求會逐個嘗試列出的VIP,直到連線成功為止,如果所有不可連線,返回錯誤
- c、客戶端已經建立後,伺服器端例項或節點故障,都將導致客戶端必須重新發起新的連線請求
Oracle RAC failover 測試(TAF方式)
Oracle RAC 客戶端故障轉移(failover),當採用TAF方式時,對於已經建立連線的客戶端,在連線的例項或節點出現故障時,客戶端無需再次發出連線請求,仍然可以繼續之前的資料庫操作,此稱之為透明故障轉移。本文描述基於Oracle 10g rac,客戶端TAF方式的故障轉移並給出示例。
下面是一些關於這方面的基礎參考連結:
有關負監聽配置,載均衡(load balance)以及Oracle service請參考
ORACLE RAC 監聽配置 (listener.ora tnsnames.ora)
ORACLE RAC 下非預設埠監聽配置(listener.ora tnsnames.ora)
Oracle RAC 客戶端連線負載均衡(Load Balance)
Oracle RAC 伺服器端連線負載均衡(Load Balance)
Oracle RAC 負載均衡測試(結合伺服器端與客戶端)
有關Oracle RAC failover 連線時故障轉移請參考
Oracle RAC failover 測試(連線時故障轉移)
Oracle RAC failover 測試(Server TAF方式)
- 1、TAF描述
- #下面關於TAF來自Oracle 的官方描述 ID 453293.1
- Transparent Application Failover (TAF) is a feature of the Oracle Call Interface (OCI) driver at client side.
- It enables the application to automatically reconnect to a database, if the database instance to which the connection is
- made fails. In this case, the active transactions roll back.
- Tnsnames Parameter: FAILOVER_MODE
- When an instance to which a connection is established fails or is shutdown, the connection on the client side becomes
- stale and would throw exceptions to the caller trying to use it. TAF enables the application to transparently reconnect
- to a preconfigured secondary instance creating a fresh connection, but identical to the connection that was established
- on the first original instance.
- #簡單一點來說,就是說對於那些已經成功連線到特定例項的客戶端,如果該例項或節點異常當機,客戶端會自動重新發出到剩餘例項的連
- #接請求。使得客戶端感覺不到它所連線的例項或節點已經出現故障,這個就稱之為透明轉移。但其間的活動事務將被回滾。
- #透過在客戶端的tnsnames.ora中配置FAILOVER_MODE項實現TAF
- 2、伺服器端、客戶端的環境
- #伺服器端環境,host資訊
- oracle@bo2dbp:~> cat /etc/hosts |grep vip
- 192.168.7.61 bo2dbp-vip.2gotrade.com bo2dbp-vip
- 192.168.7.62 bo2dbs-vip.2gotrade.com bo2dbs-vip
- #伺服器端環境,叢集資訊
- oracle@bo2dbp:~> ./crs_stat.sh
- Resource name Target State
- -------------- ------ -----
- ora.GOBO4.GOBO4A.inst OFFLINE OFFLINE on bo2dbp #此時節點1上的例項被關閉
- ora.GOBO4.GOBO4B.inst ONLINE ONLINE on bo2dbs
- ora.GOBO4.db ONLINE ONLINE on bo2dbp
- ora.bo2dbp.ASM1.asm ONLINE ONLINE on bo2dbp
- ora.bo2dbp.LISTENER_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
- ora.bo2dbp.LISTENER_ORA10G_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
- ora.bo2dbp.gsd ONLINE ONLINE on bo2dbp
- ora.bo2dbp.ons ONLINE ONLINE on bo2dbp
- ora.bo2dbp.vip ONLINE ONLINE on bo2dbp
- ora.bo2dbs.ASM2.asm ONLINE ONLINE on bo2dbs
- ora.bo2dbs.LISTENER_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
- ora.bo2dbs.LISTENER_ORA10G_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
- ora.bo2dbs.gsd ONLINE ONLINE on bo2dbs
- ora.bo2dbs.ons ONLINE ONLINE on bo2dbs
- ora.bo2dbs.vip ONLINE ONLINE on bo2dbs
- ora.ora10g.db ONLINE ONLINE on bo2dbp
- #客戶端環境
- robin@SZDB:~> cat /etc/issue
- Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l).
- robin@SZDB:~> sqlplus -v
- SQL*Plus: Release 10.2.0.3.0 - Production
- #客戶端tnsnames配置
- GOBO4_TAF =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
- (LOAD_BALANCE = yes)
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = GOBO4)
- (FAILOVER_MODE = #FAILOVER_MODE項引數
- (TYPE = session)
- (METHOD = basic)
- (RETRIES = 180
- (DELAY = 5)
- )
- )
- )
- 3、FAILOVER_MODE項分析
- FAILOVER_MODE項是實現TAF的主要配置內容,下面對其進行描述.
- METHOD: 使用者定義何時建立到其例項的連線,有BASIC 和 PRECONNECT 兩種可選值
- BASIC: 客戶端透過地址列表成功建立連線後,即僅當客戶端感知到節點故障時才建立到其他例項的連線
- PRECONNECT: 預連線模式,是在最初建立連線時就同時建立到所有例項的連線,當發生故障時,立刻就可以切換到其他鏈路上
- 上述兩種方式各有優劣,前者建立連線的開銷相對較小,但failover時會產生延遲,而後者正好與前者相反
- TYPE: 用於定義發生故障時對完成的SQL 語句如何處理,其中有2種型別:session 和select
- select:使用select方式,Oracle net會跟蹤事務期間的所有select語句,並跟蹤每一個與當前select相關的遊標已返回多少行給客戶
- 端。此時,假定select查詢已返回500行,客戶端當前連線的節點出現故障,Oracle Net自動建立連線到倖存的例項上並繼續返回
- 剩餘的行數給客戶端。假定總行數為1500,行,則1000行從剩餘節點返回。
- session: 使用session方式,所有select查詢相關的結果在重新建立新的連線後將全部丟失,需要重新發布select命令。
- 上述兩種方式適用於不同的情形,對於select方式,通常使用與OLAP資料庫,而對於session方式則使用與OLTP資料庫。因為select
- 方式,Oracle 必須為每個session儲存更多的內容,包括遊標,使用者上下文等,需要更多的資源。
- 其次,兩種方式期間所有未提交的DML事務將自動回滾且必須重啟啟動。alter session語句不會failover。
- 臨時物件不會failover也不能被重新啟動。
- RETRIES: 表示重試的次數
- DELAY:表示重試的間隔時間
- 4、測試TAF
- #首次建立連線,此時客戶端從tnsnames配置的第一個IP建立連線,由於第一個VIP所在的例項已經關閉,故連線到192.168.7.62
- #VIP 192.168.7.62對應的hostname以及instance_name分別為bo2dbs,GOBO4B,所以我們獲得如下返回結果
- #其次我們可以看到當前session failover的相關引數
- robin@SZDB:~> sqlplus <a href="mailto:fail_over/fail@gobo4_taf">fail_over/fail@gobo4_taf
- fail_over@GOBO4> get verify.sql
- 1 REM the following query is for TAF connection verification
- 2 col sid format 99999
- 3 col serial# format 9999999
- 4 col failover_type format a13
- 5 col failover_method format a15
- 6 col failed_over format a11
- 7 Prompt
- 8 Prompt Failover status for current user
- 9 Prompt ============================================
- 10 SELECT sid,
- 11 serial#,
- 12 failover_type,
- 13 failover_method,
- 14 failed_over
- 15 FROM v$session
- 16 WHERE username = 'FAIL_OVER';
- 17 REM the following query is for load balancing verification
- 18 col host_name format a20
- 19 Prompt
- 20 Prompt Current instance name and host name
- 21 Prompt ========================================
- 22* SELECT instance_name,host_name FROM v$instance;
- 23
- fail_over@GOBO4> @verify
- Failover status for current user
- ============================================
- SID SERIAL# FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
- ------ -------- ------------- --------------- -----------
- 1063 1175 SESSION BASIC NO
- Current instance name and host name
- ========================================
- INSTANCE_NAME HOST_NAME
- ---------------- --------------------
- GOBO4B bo2dbs
- #此時啟動第一個例項GOBO4A,並停止第二個例項
- oracle@bo2dbp:~> srvctl start instance -d GOBO4 -i GOBO4A
- oracle@bo2dbp:~> srvctl stop instance -d GOBO4 -i GOBO4B
- #檢視兩個例項的狀態
- oracle@bo2dbp:~> ./crs_stat.sh | grep inst
- ora.GOBO4.GOBO4A.inst ONLINE ONLINE on bo2dbp
- ora.GOBO4.GOBO4B.inst OFFLINE OFFLINE
- #在客戶端的session再次檢查連線狀態,即執行查詢,結果如下,我們收到了ORA-25408
- fail_over@GOBO4> @verify
- Failover status for current user
- ============================================
- SELECT sid,
- *
- ERROR at line 1:
- ORA-25408: can not safely replay call
- Current instance name and host name
- ========================================
- INSTANCE_NAME HOST_NAME
- ---------------- --------------------
- GOBO4A bo2dbp
- #再次執行查詢,此時客戶端已經自動實現了重新連線,從查詢返回得到的INSTANCE_NAME與HOST_NAME可知。
- #最重要的一個FAILED_OVER值為YES,表明當前的session是一個failover來的session。
- #關於METHOD使用PRECONNECT與TYPE使用SELECT的方式在此不作演示
- fail_over@GOBO4> @verify
- Failover status for current user
- ============================================
- SID SERIAL# FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER
- ------ -------- ------------- --------------- -----------
- 1073 29 SESSION BASIC YES
- Current instance name and host name
- ========================================
- INSTANCE_NAME HOST_NAME
- ---------------- --------------------
- GOBO4A bo2dbp
- #Author : Robinson
- #Blog : http://blog.csdn.net/robinson_0612
- 5、小結:
- a、客戶端TAF方式實現了Oracle客戶端到伺服器透明故障轉移
- b、主要在客戶端tnsnames.ora配置FAILOVER_MODE來實現基於客戶端的TAF
- c、FAILOVER_MODE中基於連線方式(METHOD)可以分為BASIC與PRECONNECT兩種方式,後者開銷更大,延遲小,與前者相反
- d、FAILOVER_MODE中TYPE可以分為select與session兩種方式,兩者所有未提交的事務全部回滾,select方式會failover查詢,
- session方式不會。select方式多用在OLAP型別資料庫,而session多用在OLTP型別資料庫
- e、一旦所在的例項發生故障,會自動failover,無需手動重新連線,這就是與連線時故障轉移所不同的。
About Me
...............................................................................................................................
● 本文整理自網路
● 本文在itpub(http://blog.itpub.net/26736162)、部落格園(http://www.cnblogs.com/lhrbest)和個人微信公眾號(xiaomaimiaolhr)上有同步更新
● 本文itpub地址:http://blog.itpub.net/26736162/abstract/1/
● 本文部落格園地址:http://www.cnblogs.com/lhrbest
● 本文pdf版及小麥苗雲盤地址:http://blog.itpub.net/26736162/viewspace-1624453/
● 資料庫筆試面試題庫及解答:http://blog.itpub.net/26736162/viewspace-2134706/
● QQ群:230161599 微信群:私聊
● 聯絡我請加QQ好友(646634621),註明新增緣由
● 於 2017-07-01 09:00 ~ 2017-07-31 22:00 在魔都完成
● 文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解
● 版權所有,歡迎分享本文,轉載請保留出處
...............................................................................................................................
拿起手機使用微信客戶端掃描下邊的左邊圖片來關注小麥苗的微信公眾號:xiaomaimiaolhr,掃描右邊的二維碼加入小麥苗的QQ群,學習最實用的資料庫技術。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-2142102/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 配置 RAC 負載均衡與故障轉移負載
- 靈活實現RAC三節點的負載均衡及TAF配置(五)負載
- 靈活實現RAC三節點的負載均衡及TAF配置(二)負載
- 靈活實現RAC三節點的負載均衡及TAF配置(一)負載
- 靈活實現RAC三節點的負載均衡及TAF配置(四)負載
- 靈活實現RAC三節點的負載均衡及TAF配置(三)負載
- 淺談RAC中的負載均衡負載
- [zt] RAC的負載均衡負載
- ORACLE RAC TAF 配置(透明故障轉移)Oracle
- Oracle RAC 客戶端負載均衡配置Oracle客戶端負載
- RAC_TNS故障轉移負載均衡、SCAN IP、VIP、PUBLIC IP負載
- RAC負載均衡的簡單測試(三)負載
- RAC負載均衡的簡單測試(二)負載
- RAC負載均衡的簡單測試(一)負載
- RAC負載均衡的簡單測試(四)負載
- Linux平臺上Oracle Rac中的TAF配置LinuxOracle
- rac 的Client-side TAF配置clientIDE
- Oracle RAC TAF [zt]Oracle
- Oracle RAC 客戶端故障轉移(failover) TAFOracle客戶端AI
- 配置IIS的負載均衡負載
- RAC的VIP切換測試
- Flume負載均衡配置負載
- apache 負載均衡配置Apache負載
- Jdbc thin not suppot Rac TAFJDBC
- 配置apache和nginx的tomcat負載均衡ApacheNginxTomcat負載
- 預設情況下RAC是按照SESSION數來負載均衡的 ?Session負載
- oracle goldengate for oracle rac 的安裝和切換OracleGo
- [轉載]Oracle 10g RAC TAF介紹Oracle 10g
- 兩種負載均衡的配置。負載
- RAC環境STANDBY的SWITCHOVER切換
- [zt Oracle RAC 負載均衡 --Oracle OpenWorld2007Oracle負載
- 11gR2 RAC使用SCAN故障切換問題的解決方案
- Oracle RAC DG手動切換Oracle
- Oracle 10g RAC TAFOracle 10g
- 11gr2 RAC配置Service-Side TAFIDE
- DataGuard切換(主庫為Rac+備庫為Rac)
- ORACLE RAC GUARD故障排除——RAC GUARD概念和管理Oracle
- 【TAF】使用Oracle RAC的TAF技術之SESSION型別OracleSession型別