本文共 1300 字,大约阅读时间需要 4 分钟。
RAC环境下面如果LISTENER.ORA和TNSNAMES.ORA没有配置好的话最常见的会出现
ora-12545
异常;
为了达到更好的使用目的,这里做一下总结:
首先,参考书
Oracle? Database Net Services Administrator’s Guide
Oracle? Database Net Services Reference |
在6节 Local Naming Parameters (tnsnames.ora)
有一句话比较重要
Do not set the
GLOBAL_DBNAME
parameter in the
SID_LIST_
listener_name
section of the
listener.ora
. A statically configured global database name disables connect-time failover.
首先是LISTENER.ORA配置
LISTENER_${LISTENER_NAME} =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ${VIP})(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = ${public-IP})(PORT = 1521)(IP = FIRST))
)
)
参数:(这里配置的话确保连接不会出现前面提到的情况)
local_listener=’(ADDRESS = (PROTOCOL = TCP)(HOST = ${node1-vip})(PORT = 1521))’ sid=’node1′;
local_listener=’(ADDRESS = (PROTOCOL = TCP)(HOST = ${node2-vip})(PORT = 1521))’ sid=’node2′;
客户端配置:
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ${NODE1-VIP})(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = ${NODE2-vip})(PORT = 1521))
(LOAD_BALANCE = OFF)
(FAILOVER = ON)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ${SERVICE_NAME})
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 600)
(DELAY = 1)
)
)
)
这个客户端的配置,当客户端连接时,首先连接${NODE1-VIP},然后是选择SERVICE,当SERVICE与本地跑的SID匹配时,就和NODE1建立连接,否则会连接remote_listener参数配置的节点.
转载地址:http://jimhx.baihongyu.com/