何为一个instance配置多个监听,并且实现Client Load Balancing和Client Load Balancing。
打开NETCA,配置两个监听器。
LISENTER,默认监听器,一路next,就配置完毕, 监听端口1521。
配置LISENTER2,注意监听端口改为1522,其它和LISENTER一致。
这个时候,LISENTER已经可以使用了。
但是LISENTER2还是不行,因为Oracle只会为第一个默认的监听注册服务。
在$ORACLE_HOME/NETWORK/ADMIN,编辑lisenter.ora文件,如下:
红色字体为需要增加的内容
SID_LIST_LISTENER2 =
(SID_LIST =
? (SID_DESC =
??? (SID_NAME = WWJ)
??? (ORACLE_HOME = d:\oracle\product\10.2.0\db_1)
??? (GLOBAL_DBNAME = WWJ)
? )
)
LISTENER2 =
(DESCRIPTION_LIST =
? (DESCRIPTION =
??? (ADDRESS = (PROTOCOL = tcp)(HOST = valen)(PORT = 1522))
? )
)
SID_LIST_LISTENER =
(SID_LIST =
? (SID_DESC =
??? (SID_NAME = PLSExtProc)
??? (ORACLE_HOME = d:\oracle\product\10.2.0\db_1)
??? (PROGRAM = extproc)
? )
)
LISTENER =
(DESCRIPTION_LIST =
? (DESCRIPTION =
??? (ADDRESS = (PROTOCOL = tcp)(HOST = valen)(PORT = 1521))
??? (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
? )
)
需要解释的是,SID_LIST_<lisenter name> 这里的<lisenter name>要和LISTENER名称一致。
SID_DESC则注册要提供服务的数据库实例名。这样LISTENER2 才能够提供服务。
否则会报TNS-错误。
测试过程,配置local tns name如下:
1522 =
(DESCRIPTION =
? (ADDRESS_LIST =
??? (ADDRESS = (PROTOCOL = tcp)(HOST = 127.0.0.1)(PORT = 1522))
? )
? (CONNECT_DATA =
??? (SERVICE_NAME = wwj)
? )
)
1521 =
(DESCRIPTION =
? (ADDRESS_LIST =
??? (ADDRESS = (PROTOCOL = tcp)(HOST = 127.0.0.1)(PORT = 1521))
? )
? (CONNECT_DATA =
??? (SERVICE_NAME = wwj)
? )
)
local =
(DESCRIPTION =
? (ADDRESS_LIST =
??? (ADDRESS = (PROTOCOL = tcp)(HOST = 127.0.0.1)(PORT = 1521))
??? (ADDRESS = (PROTOCOL = tcp)(HOST = 127.0.0.1)(PORT = 1522))
? )
? (CONNECT_DATA =
??? (SERVICE_NAME = wwj)
? )
)
1522和1521分别对应两个监听器,loc