ITPub博客

首页 > 数据库 > 数据库开发技术 > 你真的了解listener么

你真的了解listener么

原创 数据库开发技术 作者:zildjianzhang 时间:2008-03-20 20:58:16 0 删除 编辑

The Oracle Net listener, commonly known as the listener, brokers a client request, handing off the request to the server. The listener is configured with a protocol address. Clients configured with the same protocol address can send connection requests to the listener. Once a connection is
established, the client and Oracle database server communicate directly with one another.

listener.ora example

# listener.ora Network Configuration File: F:OracleDBOracle_homenetworkadminlistener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = F:OracleDBOracle_home)
(PROGRAM = extproc)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = zhangleihome)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)

监听的地址描述了它侦听的通信协议及service所在的主机名及还有端口号。

这里讨论listener如何工作之前, 必须清楚几个概念:

DATABASE SERVICE :An Oracle database is represented to clients as a service; that is, the database performs work on behalf of clients. A database can have one or more services associated with it.The service name is specified by the SERVICE_NAMES parameter in the initialization parameter file. The service name defaults to the global database name, a name comprising the database name (DB_NAME parameter) and domain name (DB_DOMAIN parameter).

DATABASE INTANCE :An instance is comprised of a memory area called the System Global Area (SGA) and Oracle processes.Like services, instances are identified by an instance name, sales and finance in
this example. The instance name is specified by the INSTANCE_NAME parameter in the initialization parameter file. The instance name defaults to the Oracle System Identifier (SID) of the instance.

根据以上内容,每次通过本地SQLPLUS/NOLOG登录之前,都需要设置ORACLE_SID,那么这个SID就是想要连接的实例名INSTANCE_NAME。

这种情况操作系统认证是不需要listener的。

创建试验数据库实例(故意将默认的SID=test修改为testdb,以便区分),

指定服务名(SERVICE_NAME): test.boco.com.cn

指定SID : testdb

验证:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
testdb
++++++++++++++++++++++++++++++++++++++++++++++++++

SQL> select name from v$database;

NAME
---------
TEST

++++++++++++++++++++++++++++++++++++++++++++++++++

SQL> show parameter service_name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string test.boco.com.cn

=================================================================

下面我们看建立一个连接都需要那些信息

C:>lsnrctl status

LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 21-3月 -2008 08:1
2:26

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

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=zhangleihome)(PORT=1521)))
TNS-12541: TNS: 无监听程序
TNS-12560: TNS: 协议适配器错误
TNS-00511: 无监听程序
32-bit Windows Error: 61: Unknown error
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))
TNS-12541: TNS: 无监听程序
TNS-12560: TNS: 协议适配器错误
TNS-00511: 无监听程序
32-bit Windows Error: 2: No such file or directory

C:>sqlplus/nolog

SQL*Plus: Release 10.2.0.1.0 - Production on 星期五 3月 21 08:12:32 2008

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

SQL> conn / as sysdba
已连接。

[@more@]

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

请登录后发表评论 登录
全部评论
  • 博文量
    15
  • 访问量
    206100