你好,游客 登录 注册 搜索
背景:
阅读新闻

Oracle 静态监听注册详解

[日期:2014-09-14] 来源:Linux社区  作者:wuweilong [字体: ]

网上有很多关于Oracle 监听静态注册的文章,但大多都是简单说说,并没有详细的例子,这里,将结合Linux as4 下的Oracle 10gR2.0.1 举一个具体的例子。

1、在 $ORACLE_HOME/network/admin/listener.ora 文件中加入一个静态注册的节点

[oracle@prudent oracle]$ cd $ORACLE_HOME/network/admin
 [oracle@prudent admin]$ vi listener.ora
 # listener.ora Network Configuration File: /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/listener.ora
 # Generated by Oracle configuration tools.
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /mydatafile2/app/oracle/oracle/product/11.2.0/db_1)
      (PROGRAM = extproc)
    )

    (SID_DESC =
      (SID_NAME = ORCL)
      (ORACLE_HOME = /mydatafile2/app/oracle/oracle/product/11.2.0/db_1)
      (GLOBAL_DBNAME=WOO.COM)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521))
    )
  )
 


注意这里的GLOBAL_DBNAME=WOO.COM
 SID_NAME=ORCL
这个SID_NAME 应与你对外提供服务的 $ORACLE_SID 一致

[oracle@prudent admin]$ echo $ORACLE_SID
 
 ORCL

  2、配置对应的tnsnames.ora 中的节点

[oracle@prudent admin]$ vi tnsnames.ora

# tnsnames.ora Network Configuration File: /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
 # Generated by Oracle configuration tools.
 ORCL=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCL)
    )
  )


 WOOORCL=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = WOO.COM)
    )
  )
 

tnsname WOOORCL 中的 SERVICE_NAME=WOO.COM

这里的服务名为 WOO.COM 而不是通常的 ORCL,因为在 listener.ora 中已经注册了 WOO.COM,lsnrctl 启动时会监听 WOO.COM ,并对应到 SID_NAME=ORCL 上。

3、启动监听和服务


[oracle@prudent oracle]$ cat dbstart
 lsnrctl start
 sqlplus /nolog <<EOF
 connect /as sysdba
 startup
 EOF
 [oracle@prudent oracle]$ ./dbstart

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 13-FEB-2011 20:11:15

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

Starting /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
 System parameter file is /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/listener.ora
 Log messages written to /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/log/listener.log
 Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
 Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prudent)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
 STATUS of the LISTENER
 ------------------------
 Alias                    LISTENER
 Version                  TNSLSNR for Linux: Version 11.2.0.1.0 - Production
 Start Date                13-FEB-2011 20:11:15
 Uptime                    0 days 0 hr. 0 min. 0 sec
 Trace Level              off
 Security                  ON: Local OS Authentication
 SNMP                      OFF
 Listener Parameter File  /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/listener.ora
 Listener Log File        /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/log/listener.log
 Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prudent)(PORT=1521)))
 Services Summary...
 Service "WOO.COM" has 1 instance(s).
  Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
 Service "ORCL" has 1 instance(s).
  Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
 Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
 The command completed successfully

SQL*Plus: Release 11.2.0.1.0 - Production on Sun Feb 13 20:11:16 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> Connected to an idle instance.
 SQL> ORA-32004: obsolete and/or deprecated parameter(s) specified
 ORACLE instance started.

Total System Global Area  461373440 bytes
 Fixed Size                  1220000 bytes
 Variable Size              75498080 bytes
 Database Buffers          381681664 bytes
 Redo Buffers                2973696 bytes
 Database mounted.
 Database opened.
 SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 11.2.0.1.0 - Production
 With the Partitioning, OLAP and Data Mining options


 

可以看到 
Service "WOO.COM" has 1 instance(s).
  Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
正在被监听。

4、验证该服务可以到达


[oracle@prudent oracle]$ tnsping WOOORCL

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 13-FEB-2011 20:14:59

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

Used parameter files:
 /mydatafile2/app/oracle/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora


 Used TNSNAMES adapter to resolve the alias
 Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = prudent)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = WOO.COM)))
 OK (10 msec)


5、利用静态注册的服务登入oracle
 

[oracle@prudent oracle]$ sqlplus system/oracle@WOOORCL
SQL*Plus: Release 11.2.0.1.0 - Production on Sun Feb 13 20:17:27 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


 Connected to:
 Oracle Database 10g Enterprise Edition Release 11.2.0.1.0 - Production
 With the Partitioning, OLAP and Data Mining options

SQL> select count(*) from date_log;

  COUNT(*)
 ----------

SQL>
 

至此:已验证该静态注册可以成功的被解析,监听,连接。

Oracle数据库监听非常慢,基本hang住故障处理 http://www.linuxidc.com/Linux/2014-08/104942.htm

Oracle监听之动态监听与静态监听特点 http://www.linuxidc.com/Linux/2013-09/89702.htm

Oracle 11g RAC 环境下单实例非缺省监听及端口配置 http://www.linuxidc.com/Linux/2013-08/88936.htm

Oracle 监听器日志配置与管理 http://www.linuxidc.com/Linux/2013-08/88935.htm

Oracle错误- ORA-12514:TNS:无监听程序 http://www.linuxidc.com/Linux/2013-06/85878.htm

ORA-12514 监听错误解决 http://www.linuxidc.com/Linux/2012-12/76049.htm

Oracle监听器出现的6种连接问题及其解决方法 http://www.linuxidc.com/Linux/2012-12/75568.htm

Oracle LISTENER 未监听到Oracle实例问题解决 http://www.linuxidc.com/Linux/2012-05/60910.htm

设置 Oracle 监听器密码(LISTENER) http://www.linuxidc.com/Linux/2011-07/39421.htm

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址http://www.linuxidc.com/Linux/2014-09/106631.htm

linux
相关资讯       Oracle监听  Oracle静态注册 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款