你真的了解listener么

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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/404722/viewspace-1001246/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值