remote_listener一般用在RAC环境中,单实例数据库是否可以使用该参数呢?如果可以,是否可以让listener 和数据库放在不同主机上?下面我们构造一个环境来测试下:环境:数据库在192.168.0.81上(RHEL5)listener在192.168.0.80上(RHEL5)client在192.168.0.52上(solaris10)

1,在数据库修改remote_listener参数:SQL> alter system set service_names=’test’;SQL> alter system set remote_listener=’test’;alter system set remote_listener=’test’

*ERROR at line 1:ORA-02097: parameter cannot be modified because specified value is invalidORA-00119: invalid specification for system parameter REMOTE_LISTENERORA-00132: syntax error or unresolved network name ‘test’

在tnsnames.ora里加入test条目重新运行:vi /u01/app/oracle/product/10.2.3/av_1/network/admin/tnsnames.or

test =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.80)(PORT = 1521))))

SQL> alter system set remote_listener=test;System altered.

SQL> alter system register;System altered.

然后查看本地listener和远程listener已经注册test服务:本地:[oracle@avagent ~]$ lsnrctl statusLSNRCTL for Linux: Version 11.2.0.1.0 – Production on 12-DEC-2011 21:02:53Copyright (c) 1991, 2009, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))STATUS of the LISTENER————————Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0 – ProductionStart Date 09-DEC-2011 19:34:58Uptime 3 days 1 hr. 27 min. 54 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/10.2.3/av_1/network/admin/listener.oraListener Log File /u01/app/oracle/diag/tnslsnr/avagent/listener/alert/log.xmlListening Endpoints Summary…(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=avagent.com)(PORT=1521)))Services Summary…Service “orcl.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Service “orclXDB.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Service “test.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…The command completed successfully

远程:[oracle@avserver admin]$ lsnrctl statusLSNRCTL for Linux: Version 10.2.0.3.0 – Production on 15-DEC-2011 20:42:33Copyright (c) 1991, 2006, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))STATUS of the LISTENER————————Alias LISTENERVersion TNSLSNR for Linux: Version 10.2.0.3.0 – ProductionStart Date 15-DEC-2011 20:20:03Uptime 0 days 0 hr. 22 min. 29 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/10.2.3/av_1/network/admin/listener.oraListener Log File /u01/app/oracle/product/10.2.3/av_1/network/log/listener.logListening Endpoints Summary…(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=avserver.com)(PORT=1521)))Services Summary…Service “PLSExtProc” has 1 instance(s).Instance “PLSExtProc”, status UNKNOWN, has 1 handler(s) for this service…Service “orcl.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Service “orclXDB.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Service “test.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…The command completed successfully

通过lsnrctl status ,我们可以发现,数据库已经像本地和远程的监听注册了test服务。

下面我们尝试使用远程监听连接数据库:首先在远程监听所在主机上添加tnsnames.oratest=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.80)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = test.com)))

这时我们注意到,test的host使用的远程监听的ip地址然后尝试连接:[oracle@avserver admin]$ sqlplus system/oracle@testSQL*Plus: Release 10.2.0.3.0 – Production on Thu Dec 15 20:23:43 2011Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

ERROR:ORA-12520: TNS:listener could not find available handler for requested type of server

结果是无法连接,即使远程监听已经注册test服务我们在solaris再次尝试连接:test=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.80)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = test.com)))-bash-3.00$ sqlplus system/oracle@testSQL*Plus: Release 11.2.0.3.0 Production on Thu Dec 15 20:55:21 2011Copyright (c) 1982, 2011, Oracle. All rights reserved.ERROR:ORA-12516: TNS:listener could not find available handler with matching protocol stack

虽然错误号不一致,但仍然连不进去数据库。使用lsnrctl service命令查看服务状态:[oracle@avserver admin]$ lsnrctl serviceLSNRCTL for Linux: Version 10.2.0.3.0 – Production on 15-DEC-2011 21:07:54Copyright (c) 1991, 2006, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))Services Summary…Service “PLSExtProc” has 1 instance(s).Instance “PLSExtProc”, status UNKNOWN, has 1 handler(s) for this service…Handler(s):“DEDICATED” established:0 refused:0LOCAL SERVERService “orcl.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Handler(s):“DEDICATED” established:0 refused:0 state:blockedREMOTE SERVER(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.81)(PORT=1521))Service “orclXDB.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Handler(s):“D000″ established:0 refused:0 current:0 max:1022 state:readyDISPATCHER (ADDRESS=(PROTOCOL=tcp)(HOST=avagent.com)(PORT=34266))Service “test.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Handler(s):“DEDICATED” established:0 refused:0 state:blockedREMOTE SERVER(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.81)(PORT=1521))The command completed successfully

注意到test.com的状态是blocked。根据tns错误号和服务状态为:blocked。根据普通情况,我们可以定位到是数据库的local_listener未设置,设置本地local_listener:

SQL> alter system set local_listener= ‘(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.81)(PORT=1521))’ ;

然后确保本地监听已经开启:[oracle@avagent ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 – Production on 12-DEC-2011 22:07:06Copyright (c) 1991, 2009, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))STATUS of the LISTENER————————Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0 – ProductionStart Date 12-DEC-2011 22:06:57Uptime 0 days 0 hr. 0 min. 9 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/10.2.3/av_1/network/admin/listener.oraListener Log File /u01/app/oracle/diag/tnslsnr/avagent/listener/alert/log.xmlListening Endpoints Summary…(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=avagent.com)(PORT=1521)))Services Summary…Service “orcl.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Service “orclXDB.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Service “test.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…The command completed successfully[oracle@avagent ~]$

然后在remote端查看服务状态:[oracle@avserver admin]$ lsnrctl serviceLSNRCTL for Linux: Version 10.2.0.3.0 – Production on 15-DEC-2011 21:21:43Copyright (c) 1991, 2006, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))Services Summary…Service “PLSExtProc” has 1 instance(s).Instance “PLSExtProc”, status UNKNOWN, has 1 handler(s) for this service…Handler(s):“DEDICATED” established:0 refused:0LOCAL SERVERService “orcl.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Handler(s):“DEDICATED” established:2 refused:0 state:readyREMOTE SERVER(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.81)(PORT=1521))Service “orclXDB.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Handler(s):“D000″ established:0 refused:0 current:0 max:1022 state:readyDISPATCHER (ADDRESS=(PROTOCOL=tcp)(HOST=avagent.com)(PORT=34266))Service “test.com” has 1 instance(s).Instance “orcl”, status READY, has 1 handler(s) for this service…Handler(s):“DEDICATED” established:2 refused:0 state:readyREMOTE SERVER(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.81)(PORT=1521))The command completed successfully

发现此时test.com的状态已经变为ready再次在远程listener节点上尝试通过remote_listener连接数据库:

[oracle@avserver admin]$ sqlplus system/oracle@testSQL*Plus: Release 10.2.0.3.0 – Production on Thu Dec 15 21:18:59 2011Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name,status from v$instance;INSTANCE_NAME STATUS—————- ————orcl OPEN

SQL>再次再solaris上尝试通过remote_listener连接数据库-bash-3.00$ sqlplus system/oracle@testSQL*Plus: Release 11.2.0.3.0 Production on Thu Dec 15 21:19:36 2011Copyright (c) 1982, 2011, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name,status from v$instance;INSTANCE_NAME STATUS—————- ————orcl OPEN

至此,我们实现了通过远程监听连接数据库的测试:

限制:使用remote_listener连接数据库时,本地监听也要状态正常。单独remote_listener无法连接到数据库,这使得remote_listener的作用非常鸡肋,他无法作为一个独立的监听单独存在,因为他会把收到的监听请求发生给本地监听。因此无法作为容灾监听器或者负载均衡监听器。但remote_listener也有其作用,在remote_listener和数据库之间可以使用防火墙保证网络安全。

以上均为个人总结,并未参考任何oracle note,仅作测试用途。

问题:在数据库向远程节点注册时,remote的listener.log出现如下报错:Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.80)(PORT=1521)))15-DEC-2011 21:29:39 * service_register * orcl * 12542TNS-12542: TNS:address already in useTNS-12560: TNS:protocol adapter errorTNS-00512: Address already in useLinux Error: 98: Address already in use

通过查找metalink,找到解决方案:Listener Fails to Start on Linux, Errors with TNS-12542, Linux Error: 98: Address already in use [ID 301014.1]在listener.ora使用ip代替主机名即可。重新进行远程节点注册,错误消失:TNSLSNR for Linux: Version 10.2.0.3.0 – Production on 15-DEC-2011 21:36:14Copyright (c) 1991, 2006, Oracle. All rights reserved.System parameter file is /u01/app/oracle/product/10.2.3/av_1/network/admin/listener.oraLog messages written to /u01/app/oracle/product/10.2.3/av_1/network/log/listener.logTrace information written to /u01/app/oracle/product/10.2.3/av_1/network/trace/listener.trcTrace level is currently 0Started with pid=7219Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.80)(PORT=1521)))Listener completed notification to CRS on start

TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODEWARNING: Subscription for node down event still pending15-DEC-2011 21:36:14 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=avserver.com)(USER=oracle))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=169870080)) * status * 0

15-DEC-2011 21:36:45 * service_register * orcl * 015-DEC-2011 21:36:54 * service_update * orcl * 015-DEC-2011 21:37:00 * service_update * orcl * 015-DEC-2011 21:37:09 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=test.com)(CID=(PROGRAM=sqlplus)(HOST=avserver.com)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.80)(PORT=33252)) * establish * test.com * 0但该问题与限制无关。

mysql实体监听器_使用remote_listener实现数据库与监听器分离 | HelloDML相关推荐

  1. ef mysql 读写分离_基于 EntityFramework 的数据库主从读写分离服务插件

    基于 EntityFramework 的数据库主从读写分离服务插件 1. 版本信息和源码 1.1版本信息 v1.01 beta(2015-04-07),基于 EF 6.1 开发,支持 EF 6.1 之 ...

  2. 阿里云的mysql主机名_阿里云的数据库主机名是什么

    全网最新活动请看下方内容或右侧内容! --------------- 阿里云的数据库主机名是什么,阿里云怎么建数据库. 在阿里云ecs云服务器上部署数据库后,在平常的操作中可能会遇到些问题,可以先做个 ...

  3. 阿里云mysql密码多少_阿里云默认数据库密码是多少

    阿里云默认数据库密码是多少,阿里云ecs建数据库. 对于大多数小型或初期项目来说,我们可能常用的做法是先将web.数据库全部安装在一起,后期根据需要来看是否将数据库单独迁移分离.传统物理服务器可以这么 ...

  4. mysql节假日表_节假日常见的数据库磁盘空间处理小结

    数据库的报警可以拆分为很多类别,但是有一点是无论如何都跑不掉的,而且花样百出,那就是磁盘空间报警. 在我的认知中,磁盘空间报警可以从上向下,从下向上的看待,如果从下向上看待,磁盘空间类报警的处理方法相 ...

  5. php mysql主从延迟_如何解决主从数据库同步延迟问题?php连接 mysql 数据库如何添加一个公共的配置文件50...

    在上一篇文章中,小编为您详细介绍了关于<图上属标注的什么样元器件?火车购票明明显示无座为什么样乘车后却发现有很多空座>相关知识.本篇中小编将再为您讲解标题如何解决主从数据库同步延迟问题?p ...

  6. 测试mysql连接服务器_实现服务器与数据库的连接

    如何实现服务器与数据库的连接 第一步:先建立数据库,通过apache将数据库据发布到服务器上 1.配置数据库 安装Apache2.2 2.在计算机管理 --->服务--->启动myApac ...

  7. 编写mysql的工具_自己编写的数据库工具类

    /** * 数据库工具类 * 1.连接数据库 * 2.执行增删改查功能功能并报错 * 3.没有参数传递是则使用默认信息连接 */ class mysql { private $link = null; ...

  8. mysql 嵌入式 稳定性_常用的嵌入式数据库的比较

    2.1 Berkeley DB 技术特点: 1. Berkeley DB是一个开放源代码的内嵌式数据库管理系统,能够为应用程序提供高性能的数据管理服务.应用它程序员只需要调用一些简单的API就可以完成 ...

  9. php pdo 支持mysql表类型_全新的PDO数据库操作类php版(仅适用Mysql)

    复制代码 代码如下: /** * 作者:胡睿 * 日期:2012/07/21 * 电邮:hooray0905@foxmail.com */ class HRDB{ protected $pdo; pr ...

最新文章

  1. Centos 7.4 中http-2.4 的基本实现和 https 的实现
  2. Eclipse 启动Tomcat 超时报错的解决方案
  3. 三四线城市高价房内幕:开发商坐庄,中介布局,购房者盲目下注
  4. python 延时_理解Python多线程5:加锁解决问题,但又带来麻烦!
  5. JavaScript小知识点(二):函数防抖和节流
  6. 四方聚合支付系统+新增USDT提现+全新UI+安全升级修复XSS漏洞补单漏洞 附安装教程
  7. HDLBits学习笔记——移位寄存器
  8. linux RDP 共享磁盘,USB Over Network - USB Server for Linux (RDP使用讀卡機殘念)
  9. python中反差分操作
  10. android espresso 教程,Android Espresso入门到自动搞定
  11. 计算机桌面键盘快速启动,效率神器!1秒打开电脑任何软件,推荐2款强大的快速启动器...
  12. 抖音超市开张了 王兴和梁汝波为何都念起了“超市经”?
  13. Python基础知识点六万字总结,爆肝一周熬夜完成【建议收藏】
  14. Android接入高德地图SDK,Android高德SDK 地图篇一:集成高德SDK
  15. 小程序踩坑之地图定位不精准的问题
  16. 若尔当型状态空间方程的能控能观判断
  17. 零基础自学UI设计要看什么书籍和资料
  18. 无人机感知与规避技术综述
  19. 永硕E盘:很实用的网络硬盘和网址收藏夹
  20. 高阶函数、委托与匿名方法

热门文章

  1. HTML5响应式企业集团织梦模板,(自适应手机版)响应式企业集团通用类网站织梦模板 HTML5响应式大气通用企业织梦源码+PC+wap+利于SEO优化...
  2. can sdo 报文
  3. Deepin安装使用微信
  4. matlab中设置不同的点的形状,matlab点的形状
  5. 掌银环境 和 微信浏览器 图片变形问题
  6. 在不支持PAE的机器上装Linux(Ubuntu)的方法
  7. 学习日志(一):与SISR相关又没用的一些概念
  8. 美国oracle球场,【Dubnation翻译】甲骨文球馆的恢弘“绝唱”
  9. 虚拟机配置静态IP后,已可以联网,但换了网络或者位置后无法联网
  10. Application程序jar打包笔记