Fosdccf.blog.chinaunix.net
sdccf
全部博文(19283)
Linux酷软(214)
tmp(0)
PostgreSQL(93)
Solaris(383)
AIX(173)
SCOUNIX(575)
DB2(1005)
Shell(386)
C/C++(1187)
MySQL(1750)
Sybase(465)
Oracle(3695)
Informix(548)
HP-UX(0)
IBM AIX(2)
Sun Solaris(0)
BSD(1)
Linux(8597)
SCO UNIX(23)
2011年(1)
2009年(125)
2008年(19094)
2007年(63)
clifford
linky521
曾德标
fengzhan
leon_yu
mcuflowe
yt200902
guanyuji
GY123456
snow888
carlos94
丸喵喵
sean229
cxunix
可怜的猪
cqxc413
xzzgege
wb123456
分类: Oracle
2008-04-30 15:15:36
如何为一个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_ 这里的要和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分别对应两个监听器,local稍后再解释:测试:SQL> conn [url=mailto:wwj/wwj@1521]wwj/wwj@1521已连接。SQL> conn [url=mailto:wwj/wwj@1522]wwj/wwj@1522已连接。OK,再看local,(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1522))这里的意思是,该命名对应了两个监听端口,如果一个Crash,会立刻切换到另外一个。并且如果多个连接,会随机的分配监听。测试SQL> conn [url=mailto:wwj/wwj@local]wwj/wwj@local已连接。STOP LISENTER,再次连接,这个时候,连接比第一次慢了1秒钟左右SQL> conn [url=mailto:wwj/wwj@local]wwj/wwj@local已连接。成功,这时连接上了LISTENER2关于Oracle网络服务的资料,在OCP教材的第四章Oracle Net Services有很清晰的说明。
原文:http://valen.blog.ccidnet.com/blog-htm-itemid-281672-do-showone-type-blog-uid-51502.html
上一篇:Oracle初学者必知的100个问题
下一篇:Oracle并发插入的机制
登录 注册