ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 侦听器研究(动态注册不明白)

侦听器研究(动态注册不明白)

原创 Linux操作系统 作者:highclous 时间:2011-07-28 20:00:49 0 删除 编辑

1 在Oracle数据库本地进行连接

SQL> conn scott/tiger
Connected.
SQL> conn scott/tiger@ocp11g
ERROR:
ORA-12541: TNS:no listener
看来本地侦听器没有配置成功

2 查看本地侦听器状态
[oracle@TServer2 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-JUL-2011 09:36:35

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                28-JUL-2011 08:10:36
Uptime                    0 days 1 hr. 25 min. 59 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/TServer2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
The listener supports no services
The command completed successfully


3 查看本地服务器的listener.ora,tnsname.ora
__________________________
listener.ora
__________________________
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
  )

ADR_BASE_LISTENER = /u01/app/oracle
__________________________
tnsname.ora
__________________________
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

OCP11G =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.16.232)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ocp11g.dss)
    )
  )

TNSPING 一下OCP11G的情况
[oracle@TServer2 ~]$ tnsping OCP11G

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 28-JUL-2011 09:37:32

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.16.232)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ocp11g.dss)))
TNS-12541: TNS:no listener

果然是没有监听啊

4 查看实例的相关信息

SQL> show parameter service_name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      ocp11g.dss
SQL> show parameter instance_name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      ocp11g
SQL> show parameter local_listener;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string

“动态实例注册是向侦听器注册实例的一个首选方法。初始化参数local_listener会告知实例应当进行联系的、从而能够查找到注册实例的侦听器的网络地址。”

5 设置一个local_listener试试
SQL> alter system set local_listener=LISTENER;

System altered.
 测试不中啊,始终不理解动态注册的意思……

6 增加静态注册的内容:
找了一个可用的服务器,照猫画虎的改成了如下的样子:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = ocp11g.dss)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
      (SID_NAME = ocp11g)
    )
    (SID_DESC =
      (PROGRAM = extproc)
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.16.233)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )
可以使用了,远程测试也成功。




来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20399666/viewspace-703359/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-07-27

  • 博文量
    11
  • 访问量
    14419