Oracle 11g RAC客戶端使用SCAN IP無法連線問題
Oracle 版本:11.2.0.1.0
客戶端:Windows Server 2003/PLSQL Developer
Oracle伺服器端的ip設定如下:
##公網ip
192.168.135.201 WIN-2008SERVER1
192.168.135.202 WIN-2008SERVER2
##虛擬ip
192.168.135.211 WIN-2008SERVER1-vip
192.168.135.212 WIN-2008SERVER2-vip
##私網ip
10.168.135.201 WIN-2008SERVER1-pri
10.168.135.202 WIN-2008SERVER2-pri
##SCAN ip
192.168.135.220 scan
兩個RAC例項的虛擬ip已經設定為ip地址而不是名稱,如下:
客戶端PLSQL Developer的tnsnames.ora設定如下:
ORCL = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.135.201)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.135.202)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
(FAILOVER_MODE =
(TYPE = select)
(METHOD = basic)
(RETRIES = 180)
(DELAY = 5)
)
)
scan =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
192.168.135.200 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.135.200)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
使用PLSQL Developer連線ORCL,沒有任何問題。
客戶端Windows的hosts檔案沒有修改之前,使用PLSQL Developer連線Oracle的SCAN ip 192.168.135.200,異常如下:
ORA-12541: TNS: no listener
連線Oracle的SCAN名稱scan,異常如下:
ORA-12545: Connect failed because target host or object does not exist
網上有說升級Oracle版本就可以解決的,沒有嘗試過,不知道可否?
也有說將RAC例項的local_listener修改為虛擬ip就可以的,但是已經是這樣了,不知為何?
最後,客戶端Windows的hosts檔案新增Oracle伺服器端的虛擬ip和SCAN ip的設定,重啟作業系統之後,使用PLSQL Developer連線Oracle的SCAN名稱scan,連線成功!
擴充套件話題:如果SCAN名稱直接設定為ip地址(不知Oracle是否支援?),客戶端PLSQL Developer連線的host名稱也就可以填寫為ip地址了,這樣看起來就和連單機Oracle例項很像了。
擴充套件閱讀:
ORA-12541: TNS:no listener ( ERROR coming when one node of RAC database is off
java應用連線oracle 11g R2 rac (用scanip連線報錯)
11gR2 clients connect to the database using SCANs
scan-ip部分可以連線,部分連線不了