oracle 动态注册监听问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle 动态注册监听问题相关的知识,希望对你有一定的参考价值。
1。我编辑了一个listener.ora,
L1=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=test)(PORT=1526))
但是我没有办法把它设置成local_listener,还需要编辑一个tnsnames.ora和这个L1对应才可以,为什么?
2。当我set local_listerner='(ADDRESS=(PROTOCOL=tcp)(HOST=test)(PORT=1526))';就可以设置成功(此时没有listener.ora和tnsnames.ora文件),为什么?
3。设置 local_listerner不就是为了改变pmon进程向非默认监听注册吗?为什么就算把 local_listerner设置成了L1,当我lsnrctl start后还是启动了那个port=1521的LISTNERE?
alter system set local_listener='L1';
如果tnsnames.ora里没有设置 L1,就用
alter system set local_listerner='(ADDRESS=(PROTOCOL=tcp)(HOST=test)(PORT=1526))';
这两个是一个效果
如果改监听端口,需要改listener.ora,如果这文件不在或不改,就只能是1521
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test)(PORT = 1526))
)
改完这文件,还需要重新启动监听,且改完local_listener后才能动态注册到1526端口上本回答被提问者采纳
oracle监听
监听:
为客户端提供连接到服务器端的数据库的接口
一、使用netmgr工具配置监听:
(其他配置监听方式:
1 netca ,比较简单
2 直接修改配置文件
)
[[email protected] admin]$ netmgr
动态监听:
(数据库的pmon进程会自动注册到监听里面来,不过可能需要点时间(必需是默认监听listener))
(非默认监听的动态监听需要手工让数据库注册到监听:alter system set local_listener=‘(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.111)(PORT=1522))‘)
静态监听:(需要绑定数据库)
启动监听:
[[email protected] admin]$ lsnrctl start
#默认启动的监听是listener , 如果启动监听L1 则: lsnrctl start L1
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 08-JUN-2017 17:33:52
Uptime 0 days 0 hr. 0 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
Services Summary...
Service "fsdb" has 1 instance(s). # service name 在连接监听时需要用到
Instance "fsdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
通过监听使用命令连接服务器:
sqlplus system/[email protected]:1521/fsdb
二、通过配置文件的方式连接服务:
创建tns配置文件:
下一步选择协议:省略
连接服务器:
[[email protected] admin]$ sqlplus system/[email protected] #f1上面配置tns时第一步设置的
三、通过修改配置文件手工配置监听:
通过图形化配置监听和tns实质上就是修改配置文件:
$ORACLE_HOME/network/admin/ 目录下的文件 listener.ora (监听配置文件) tnsnames.ora(tns配置文件)
配置文件例子:
监听多个实例的例子:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = RROD4)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = PROD4)
)
(SID_DESC =
(GLOBAL_DBNAME = EMREP)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = EMREP)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = edsir1p8.us.oracle.com)(PORT = 1521))
)
ADR_BASE_LISTENER = /u01/app/oracle
监听不同端口的例子:
L1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = edsir1p8.us.oracle.com)(PORT = 1522))
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = PROD4)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = PROD4)
)
)
ADR_BASE_L1 = /u01/app/oracle
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = edsir1p8.us.oracle.com)(PORT = 1521))
)
ADR_BASE_LISTENER = /u01/app/oracle
SID_LIST_L1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = PROD4-1522)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = PROD4)
)
)
tns配置文件:
P4 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.190.104.28)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = PROD4.us.oracle.com)
)
)
以上是关于oracle 动态注册监听问题的主要内容,如果未能解决你的问题,请参考以下文章